<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sql Server Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/category/databases/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/category/databases/sql-server/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Tue, 30 Jan 2024 18:30:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Provision a database programmatically in Azure SQL database with a failover group</title>
		<link>https://blogit.create.pt/miguelisidoro/2024/01/24/provision-a-database-programmatically-in-azure-sql-database-with-a-failover-group/</link>
					<comments>https://blogit.create.pt/miguelisidoro/2024/01/24/provision-a-database-programmatically-in-azure-sql-database-with-a-failover-group/#respond</comments>
		
		<dc:creator><![CDATA[Miguel Isidoro]]></dc:creator>
		<pubDate>Wed, 24 Jan 2024 14:32:24 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=12852</guid>

					<description><![CDATA[<p>This post will explain how to provision a database programmatically in a Azure SQL database and add it to an Azure SQL failover group. Introduction An Azure SQL Server failover group is a group of databases that can be automatically or manually failed over from a primary server to a secondary server in a different [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2024/01/24/provision-a-database-programmatically-in-azure-sql-database-with-a-failover-group/">Provision a database programmatically in Azure SQL database with a failover group</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This post will explain how to provision a database programmatically in a Azure SQL database and add it to an Azure SQL failover group.</p>



<h2 class="wp-block-heading">Introduction</h2>



<p>An Azure SQL Server failover group is a group of databases that can be automatically or manually failed over from a primary server to a secondary server in a different Azure region in case of a disaster in the primary server. Failover groups provide high availability and disaster recovery for Azure SQL Server databases.</p>



<p>The process described in this post is composed by two main steps:</p>



<ul class="wp-block-list">
<li>Provisioning the database</li>



<li>Adding the database to the failover group </li>
</ul>



<h2 class="wp-block-heading">Provisioning the database</h2>



<p>The first step is to create the database. This step is composed by the following actions:</p>



<ul class="wp-block-list">
<li>Get the tenant information</li>



<li>Create the database</li>
</ul>



<p>Tenant information class:</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="791" height="381" src="https://blogit.create.pt/wp-content/uploads/2024/01/Regions.jpg" alt="" class="wp-image-12869" srcset="https://blogit.create.pt/wp-content/uploads/2024/01/Regions.jpg 791w, https://blogit.create.pt/wp-content/uploads/2024/01/Regions-300x145.jpg 300w, https://blogit.create.pt/wp-content/uploads/2024/01/Regions-768x370.jpg 768w, https://blogit.create.pt/wp-content/uploads/2024/01/Regions-696x335.jpg 696w" sizes="(max-width: 791px) 100vw, 791px" /></figure>



<p>Code to create database programatically:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="722" src="https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-1024x722.jpg" alt="" class="wp-image-12866" srcset="https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-1024x722.jpg 1024w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-300x212.jpg 300w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-768x542.jpg 768w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-696x491.jpg 696w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-596x420.jpg 596w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase-100x70.jpg 100w, https://blogit.create.pt/wp-content/uploads/2024/01/CreateDatabase.jpg 1065w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Adding the database to the failover group</h2>



<p>The second step adds the newly created database to the failover group. This step is composed by the following actions:</p>



<ul class="wp-block-list">
<li>Get the failover group where we want to add the database</li>



<li>Re-add the existing databases to the failover group &#8211; necessary since when we get the failover group the list of databases of the group is empty and, without this step, the failover group would only have the new database</li>



<li>Add the new database to the failover group</li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="790" height="344" src="https://blogit.create.pt/wp-content/uploads/2024/01/Failovergroup.jpg" alt="" class="wp-image-12876" srcset="https://blogit.create.pt/wp-content/uploads/2024/01/Failovergroup.jpg 790w, https://blogit.create.pt/wp-content/uploads/2024/01/Failovergroup-300x131.jpg 300w, https://blogit.create.pt/wp-content/uploads/2024/01/Failovergroup-768x334.jpg 768w, https://blogit.create.pt/wp-content/uploads/2024/01/Failovergroup-696x303.jpg 696w" sizes="(max-width: 790px) 100vw, 790px" /></figure>



<h2 class="wp-block-heading">Other Articles</h2>



<p>To learn why your business should migrate to SharePoint Online and Office 365, click <a href="https://blogit.create.pt////miguelisidoro/2019/07/29/why-your-business-should-migrate-to-sharepoint-online-and-office-365-the-value-offer-part-1/" target="_blank" rel="noreferrer noopener">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2019/07/29/why-your-business-should-migrate-to-sharepoint-online-and-office-365-the-value-offer-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to learn how to develop SPFx solutions, click <a href="https://blogit.create.pt/miguelisidoro/2022/05/09/sharepoint-framework-spfx-learning-guide/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to learn how you can rename a modern SharePoint site, click <a href="https://blogit.create.pt////miguelisidoro/2019/09/23/how-to-rename-a-modern-sharepoint-site-url-in-office-365/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to learn how to save time time scheduling your meetings, click&nbsp;<a href="https://blogit.create.pt////miguelisidoro/2020/04/12/save-time-scheduling-microsoft-teams-meetings-using-findtime/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to learn how to enable Microsoft Teams Attendance List Download, click&nbsp;<a href="https://blogit.create.pt////miguelisidoro/2020/09/20/how-to-enable-teams-meeting-attendance-list-download-in-microsoft-365/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to learn how to create a dynamic org-wide team in Microsoft Teams with all active employees, click&nbsp;<a href="https://blogit.create.pt/miguelisidoro/2020/09/21/how-to-create-a-dynamic-team-in-microsoft-teams-with-all-active-employees-in-microsoft-365/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>If you want to modernize your SharePoint classic root site to a modern SharePoint site, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/08/27/how-to-modernize-your-tenant-root-site-collection-in-office-365-using-invoke-spositeswap/" target="_blank">here</a>.</p>



<p>If you are a SharePoint administrator or a SharePoint developer who wants to learn more about how to install a SharePoint 2019 farm in an automated way using PowerShell, I invite you to click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/12/09/how-to-install-a-sharepoint-2019-farm-using-powershell-and-autospinstaller-part-1/" target="_blank">here</a>&nbsp;and&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/12/09/how-to-install-a-sharepoint-2019-farm-using-powershell-and-autospinstaller-part-2/" target="_blank">here</a>.</p>



<p>If you learn how to greatly speed up your SharePoint farm update process to ensure your SharePoint farm keeps updated and you stay one step closer to start your move to the cloud, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/05/02/how-to-speed-up-the-installation-of-sharepoint-cumulative-updates-using-powershell-step-by-step/" target="_blank">here</a>.</p>



<p>If you prefer to use the traditional method to update your farm and want to learn all the steps and precautions necessary to successfully keep your SharePoint farm updated, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/04/08/how-to-install-sharepoint-cumulative-updates-in-a-sharepoint-farm-step-by-step/" target="_blank">here</a>.</p>



<p>If you want to learn how to upgrade a SharePoint 2013 farm to SharePoint 2019, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/03/06/how-to-upgrade-from-sharepoint-2013-to-sharepoint-2019-step-by-step-part-1/" target="_blank">here&nbsp;</a>and&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/03/06/how-to-upgrade-from-sharepoint-2013-to-sharepoint-2019-step-by-step-part-2/" target="_blank">here</a>.</p>



<p>If SharePoint 2019 is still not an option, you can learn more about how to install a SharePoint 2016 farm in an automated way using PowerShell, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-1/" target="_blank">here</a>&nbsp;and&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-2/" target="_blank">here</a>.</p>



<p>If you want to learn how to upgrade a SharePoint 2010 farm to SharePoint 2016, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/02/04/sharepoint-upgrade-upgrading-a-sharepoint-2010-farm-to-sharepoint-2016-step-by-step-part-1/" target="_blank">here&nbsp;</a>and&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/02/04/sharepoint-upgrade-upgrading-a-sharepoint-2010-farm-to-sharepoint-2016-step-by-step-part-2/" target="_blank">here</a>.</p>



<p>If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/10/17/sharepoint-and-office-365-learning-resources/" target="_blank">learning resources</a>.</p>



<p>If you are work in a large organization who is using Office 365 or thinking to move to Office 365 and is considering between a single or multiple Office 365 tenants, I invite you to read&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2019/01/07/pros-and-cons-of-single-tenant-vs-multiple-tenants-in-office-365/" target="_blank">this article</a>.</p>



<p>If you want to know all about the latest SharePoint and Office 365 announcements from Ignite and some more recent announcements, including Microsoft Search, What’s New to Build a Modern Intranet with SharePoint in Office 365, Deeper Integration between Microsoft Teams and SharePoint and the latest news on SharePoint development, click&nbsp;<a rel="noreferrer noopener" href="https://blogit.create.pt////miguelisidoro/2018/11/21/whats-new-for-sharepoint-and-office-365-after-microsoft-ignite-2018/" target="_blank">here</a>.</p>



<p>If your organization is still not ready to go all in to SharePoint Online and Office 365, a hybrid scenario may be the best choice. SharePoint 2019 RTM was recently announced and if you to learn all about SharePoint 2019 and all its features, click <a href="https://blogit.create.pt////miguelisidoro/2018/11/01/meet-the-new-modern-sharepoint-server-sharepoint-2019-rtm-is-here/" target="_blank" rel="noreferrer noopener">here</a>.</p>



<p>Happy Coding!</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2024/01/24/provision-a-database-programmatically-in-azure-sql-database-with-a-failover-group/">Provision a database programmatically in Azure SQL database with a failover group</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/miguelisidoro/2024/01/24/provision-a-database-programmatically-in-azure-sql-database-with-a-failover-group/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Query performance for JSON objects inside SQL Server using JSON_VALUE function</title>
		<link>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/</link>
					<comments>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Gonçalo Melo]]></dc:creator>
		<pubDate>Thu, 20 Dec 2018 09:39:12 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=8077</guid>

					<description><![CDATA[<p>Following up on this article about querying JSON Data I would like to talk about how to improve searches on JSON data inside SQL Server. Starting SQL Server 2016 Microsoft deployed a set of functions that allow us to work with JSON data in a structured way inside SQL Server. I will introduce a small [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/">Query performance for JSON objects inside SQL Server using JSON_VALUE function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Following up on <a href="https://blogit.create.pt////diogoguiomar/2018/02/26/query-a-json-array-column-in-sql/">this article about querying JSON Data</a> I would like to talk about how to improve searches on JSON data inside SQL Server. Starting SQL Server 2016 Microsoft deployed a set of functions that allow us to work with JSON data in a structured way inside SQL Server.</p>



<p>I will introduce a small usage sample for the <strong>JSON_VALUE </strong>function in combination with indexes to improve information retrieval from a table containing one JSON object. For our testes, we have a <strong>UserDetailTest </strong>table that has more than 500k rows with 2 columns: an UserId and a nvarchar(max) to hold a small JSON details string like the following:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
SELECT *, LEN(DetailsJSON) AS &#x5B;Len(DetailsJSON)] FROM UserDetailTest
</pre></div>


<figure class="wp-block-image"><img decoding="async" width="937" height="188" src="https://blogit.create.pt////wp-content/uploads/2018/12/sampleTable.png" alt="" class="wp-image-8153" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable.png 937w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-300x60.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-768x154.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-696x140.png 696w" sizes="(max-width: 937px) 100vw, 937px" /></figure>



<p>I will activate time statistics and clean SQL Server cache between each query to have some consistency across the execution times using the following SQL statements:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
CHECKPOINT
DBCC DROPCLEANBUFFERS
SET STATISTICS TIME ON
</pre></div>


<h2 class="wp-block-heading">JSON_VALUE Function intro</h2>



<p>The JSON_VALUE function extracts a value from a JSON string. This functions receives 2 arguments, the first being an expression for the JSON value and the second a path for the value we want to obtain. A simple sample with an inline JSON object would be the following:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
SELECT JSON_VALUE('{"PostalCode":"376-3765","PhoneNumber":"351003765718"}', '$.PhoneNumber')
</pre></div>


<figure class="wp-block-image"><img decoding="async" width="1245" height="123" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult0.png?fit=696%2C69&amp;ssl=1" alt="" class="wp-image-8182" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0.png 1245w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-300x30.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-768x76.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-1024x101.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-696x69.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-1068x106.png 1068w" sizes="(max-width: 1245px) 100vw, 1245px" /></figure>



<p>The return is a scalar value (nvarchar(4000)) for the PhoneNumber element.</p>



<h2 class="wp-block-heading">Query scenarios</h2>



<p>Starting with one of the <strong>really&nbsp;worst </strong>case scenario (yes, this can happen&#8230;):</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="240" src="https://blogit.create.pt////wp-content/uploads/2018/12/selectResult20-1024x240.png" alt="" class="wp-image-8197" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-1024x240.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-300x70.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-768x180.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-696x163.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-1068x250.png 1068w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20.png 1275w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>More than 17 seconds really seems like a worst scenario! Next, we will use the JSON_VALUE function to get the PhoneNumber from the JSON string and use it in our where clause:</p>



<figure class="wp-block-image"><img decoding="async" width="1266" height="301" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult22.png?fit=696%2C165&amp;ssl=1" alt="" class="wp-image-8198" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22.png 1266w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-300x71.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-768x183.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-1024x243.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-696x165.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-1068x254.png 1068w" sizes="(max-width: 1266px) 100vw, 1266px" /></figure>



<p>This still takes more than 3 seconds. A good improvement, but yet a high cost if we need to search information in this way.</p>



<h2 class="wp-block-heading" id="mce_9">Index creation</h2>



<p>Let&#8217;s add a new virtual column to table that displays the result from the JSON_VALUE function &#8211; this will allow us to create an index and simplify the SELECT queries.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
ALTER TABLE UserDetailTest 
	ADD vPhoneNumber AS 
	CAST(JSON_VALUE(DetailsJSON, '$.PhoneNumber') AS NVARCHAR(255));
</pre></div>


<p>The cast truncates the output from the JSON_VALUE&nbsp;to ensure that it does not exceed the maximum lenght for the index key. Now, if we search using the column, the result is still more or less the same 3 seconds has before:</p>



<ul class="wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><img decoding="async" width="1274" height="311" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult23.png?fit=696%2C170&amp;ssl=1" alt="" data-id="8199" data-link="https://blogit.create.pt////?attachment_id=8199" class="wp-image-8199" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23.png 1274w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-300x73.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-768x187.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-1024x250.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-696x170.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-1068x261.png 1068w" sizes="(max-width: 1274px) 100vw, 1274px" /></figure></li></ul>



<p>Let&#8217;s create an index and perform the search again:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
CREATE INDEX idx_vPhoneNumber ON &#x5B;UserDetailTest] (vPhoneNumber);

</pre></div>


<ul class="wp-block-gallery columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><img decoding="async" width="1270" height="316" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult24.png?fit=696%2C173&amp;ssl=1" alt="" data-id="8201" data-link="https://blogit.create.pt////?attachment_id=8201" class="wp-image-8201" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24.png 1270w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-300x75.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-768x191.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-1024x255.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-696x173.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-1068x266.png 1068w" sizes="(max-width: 1270px) 100vw, 1270px" /></figure></li></ul>



<p>Consequently the improvement is huge, 13 miliseconds is more interesting! But what&#8217;s the cost?</p>



<h2 class="wp-block-heading">The cost</h2>



<p>When we create an index, we&#8217;re basically trading space for time &#8211; more occupied space versus faster operations. Therefore let&#8217;s see what the increase is using&nbsp;<strong>sp_spaceused</strong> function before and after index creation:</p>



<table class="wp-block-table is-style-regular"><tbody><tr><td></td><td><strong>rows</strong></td><td><strong>reserved</strong></td><td><strong>data</strong></td><td><strong>index_size</strong></td><td><strong>unused</strong></td></tr><tr><td><strong>Initial</strong></td><td>557801              </td><td>1120904 KB</td><td>1115584 KB</td><td>5224 KB</td><td>96 KB</td></tr><tr><td><strong>After Index</strong></td><td>557801</td><td>1148752 KB</td><td>1115584 KB</td><td>32992 KB</td><td>176 KB</td></tr></tbody></table>



<p>Probably, an interesting comparison would be if the PhoneNumber column was an explicit column in that table containing the value. Let&#8217;s do that!</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
ALTER TABLE UserDetailTest  
	ADD PhoneNumberCopy NVARCHAR(255)

UPDATE UserDetailTest
	SET PhoneNumberCopy = vPhoneNumber
</pre></div>


<p>The sp_spaceused remained the same &#8211; SQL Server internal black magic regarding space allocation (for another time!). But performance wise, for this approach in my machine this query still took more than 2 seconds to complete:</p>



<figure class="wp-block-image"><img decoding="async" width="1269" height="362" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult26.png?fit=696%2C198&amp;ssl=1" alt="" class="wp-image-8203" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26.png 1269w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-300x86.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-768x219.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-1024x292.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-696x199.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-1068x305.png 1068w" sizes="(max-width: 1269px) 100vw, 1269px" /></figure>



<p>Slightly better than the query with the JSON function but the advantage is that in this scenario SQL can better optimize the searches. The following runs of the same query without clearing the cache returns results much faster &#8211; each took around 220 miliseconds to complete:</p>



<figure class="wp-block-image"><img decoding="async" width="1263" height="343" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult27.png?fit=696%2C189&amp;ssl=1" alt="" class="wp-image-8204" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27.png 1263w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-300x81.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-768x209.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-1024x278.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-696x189.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-1068x290.png 1068w" sizes="(max-width: 1263px) 100vw, 1263px" /></figure>



<h2 class="wp-block-heading">Summary Results</h2>



<p>Just to sum up all the results for the different types of searches comparing the first execution after cache clean up and the following runs.&nbsp;I did several iterations for each step just to make sure the results were consistent&nbsp;although the goal was just to have a baseline. Certanly, the use of this will depend on each case.</p>



<table class="wp-block-table"><tbody><tr><td><strong>WHERE clausule type</strong></td><td><strong>First run</strong></td><td><strong>Following runs</strong></td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE DetailsJson LIKE '%PhoneNumber&quot;:&quot;351003765718&quot;%'</pre></td><td>17754 ms</td><td>around the same</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE JSON_VALUE(DetailsJson, '$.PhoneNumber') = '351003765718'</pre></td><td>3375 ms</td><td>1958 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE vPhoneNumber = '351003765718'</pre>vPhoneNumber is not indexed&nbsp;</td><td>3339 ms</td><td>1332 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE vPhoneNumber = '351003765718'</pre> vPhoneNumber is indexed</td><td>13 ms</td><td>0 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE PhoneNumberCopy  = '351003765718'</pre>PhoneNumberCopy&nbsp; is of type nvarchar(255) and explicitly contains all values</td><td>2309 ms</td><td>222 ms</td></tr></tbody></table>



<p></p>
<p>The post <a href="https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/">Query performance for JSON objects inside SQL Server using JSON_VALUE function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Converting a Vertical Table to an Horizontal Table in SQL Server</title>
		<link>https://blogit.create.pt/ricardocosta/2016/10/27/converting-a-vertical-table-to-an-horizontal-table-in-sql-server/</link>
					<comments>https://blogit.create.pt/ricardocosta/2016/10/27/converting-a-vertical-table-to-an-horizontal-table-in-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Thu, 27 Oct 2016 21:24:13 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Sql]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[tsq]]></category>
		<guid isPermaLink="false">http://blogit.create.pt/ricardocosta/?p=1421</guid>

					<description><![CDATA[<p>Today I&#8217;ve encountered a vertical table in an SQL Database and I wanted to transform it to an horizontal one. A vertical table is described as an EAV model. Imagine you have this table CREATE TABLE VerticalTable ( Id int, Att_Id varchar(50), Att_Value varchar(50) ) INSERT INTO VerticalTable SELECT 1, 'FirstName', 'John' UNION ALL SELECT [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2016/10/27/converting-a-vertical-table-to-an-horizontal-table-in-sql-server/">Converting a Vertical Table to an Horizontal Table in SQL Server</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Today I&#8217;ve encountered a vertical table in an SQL Database and I wanted to transform it to an horizontal one. A vertical table is described as an <a href="https://goo.gl/5aym8G" target="_blank" rel="noopener">EAV model</a>.</p>
<p>Imagine you have this table</p>
<pre class="brush: sql; title: ; notranslate">

CREATE TABLE VerticalTable
(
Id int,
Att_Id varchar(50),
Att_Value varchar(50)
)

INSERT INTO VerticalTable
SELECT 1, 'FirstName', 'John' UNION ALL
SELECT 1, 'LastName', 'Smith' UNION ALL
SELECT 1, 'Email', 'john.smith@dummy.com' UNION ALL
SELECT 2, 'FirstName', 'Jack' UNION ALL
SELECT 2, 'LastName', 'Daniels' UNION ALL
SELECT 2, 'Email', 'jack.daniels@dummy.com'

</pre>
<p>If you run</p>
<pre class="brush: sql; title: ; notranslate">

SELECT * FROM VerticalTable

</pre>
<p>you get this</p>
<table class="sqloutput">
<tbody>
<tr>
<th></th>
<th>Id</th>
<th>Att_Id</th>
<th>Att_Value</th>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>FirstName</td>
<td>John</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>LastName</td>
<td>Smith</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>Email</td>
<td>john.smith@dummy.com</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>FirstName</td>
<td>Jack</td>
</tr>
<tr>
<td>5</td>
<td>2</td>
<td>LastName</td>
<td>Daniels</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
<td>Email</td>
<td>jack.daniels@dummy.com</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>To convert this into an horizontal table I&#8217;m going to use <a href="https://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx" target="_blank" rel="noopener">PIVOT</a>.</p>
<pre class="brush: sql; title: ; notranslate">

SELECT &#x5B;Id], &#x5B;FirstName], &#x5B;LastName], &#x5B;Email] 
FROM
(
 SELECT Id, Att_Id, Att_Value FROM VerticalTable
) as source
PIVOT
(
 MAX(Att_Value) FOR Att_Id IN (&#x5B;FirstName], &#x5B;LastName], &#x5B;Email])
) as target

</pre>
<p>And I will get this</p>
<table class="sqloutput">
<tbody>
<tr>
<th></th>
<th>Id</th>
<th>FirstName</th>
<th>LastName</th>
<th>Email</th>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>John</td>
<td>Smith</td>
<td>john.smith@dummy.com</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>Jack</td>
<td>Daniels</td>
<td>jack.daniels@dummy.com</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>You can find the code <a href="http://rextester.com/NSKR13741" target="_blank" rel="noopener">here</a>.</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2016/10/27/converting-a-vertical-table-to-an-horizontal-table-in-sql-server/">Converting a Vertical Table to an Horizontal Table in SQL Server</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2016/10/27/converting-a-vertical-table-to-an-horizontal-table-in-sql-server/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Persisted Computed Column ANSI_NULLS</title>
		<link>https://blogit.create.pt/ricardocosta/2015/11/25/sql-persisted-computed-column-ansi_nulls/</link>
					<comments>https://blogit.create.pt/ricardocosta/2015/11/25/sql-persisted-computed-column-ansi_nulls/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Wed, 25 Nov 2015 14:06:15 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<guid isPermaLink="false">http://blogit.create.pt/ricardocosta/?p=1081</guid>

					<description><![CDATA[<p>I had to recreate a table in SQL Server just because it was created with ANSI_NULLS ON Here you can check the requirements to create a persisted  computed column on SQL Server. &#8220;&#8230;the SET options in the following table must be set to the values shown in the Required value column&#8230;&#8221; SET options Required value [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2015/11/25/sql-persisted-computed-column-ansi_nulls/">SQL Persisted Computed Column ANSI_NULLS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I had to recreate a table in SQL Server just because it was created with ANSI_NULLS ON</p>
<p><a title="SET Options That Affect Results" href="https://msdn.microsoft.com/en-us/library/ms175088.aspx" target="_blank">Here</a> you can check the requirements to create a persisted  computed column on SQL Server.</p>
<p><em>&#8220;&#8230;the SET options in the following table must be set to the values shown in the Required value column&#8230;&#8221;</em></p>
<table>
<tbody>
<tr>
<th>SET options</th>
<th>Required value</th>
<th>Default server value</th>
<th>Default</p>
<p>OLE DB and ODBC value</th>
<th>Default</p>
<p>DB-Library value</th>
</tr>
<tr>
<td>ANSI_NULLS</td>
<td>ON</td>
<td>OFF</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr>
<td>ANSI_PADDING</td>
<td>ON</td>
<td>ON</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr>
<td>ANSI_WARNINGS*</td>
<td>ON</td>
<td>OFF</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr>
<td>ARITHABORT</td>
<td>ON</td>
<td>ON</td>
<td>OFF</td>
<td>OFF</td>
</tr>
<tr>
<td>CONCAT_NULL_YIELDS_NULL</td>
<td>ON</td>
<td>OFF</td>
<td>ON</td>
<td>OFF</td>
</tr>
<tr>
<td>NUMERIC_ROUNDABORT</td>
<td>OFF</td>
<td>OFF</td>
<td>OFF</td>
<td>OFF</td>
</tr>
<tr>
<td>QUOTED_IDENTIFIER</td>
<td>ON</td>
<td>OFF</td>
<td>ON</td>
<td>OFF</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2015/11/25/sql-persisted-computed-column-ansi_nulls/">SQL Persisted Computed Column ANSI_NULLS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2015/11/25/sql-persisted-computed-column-ansi_nulls/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Access the Previous Row and Next Row value in SELECT statement?</title>
		<link>https://blogit.create.pt/ricardocosta/2014/11/07/how-to-access-the-previous-row-and-next-row-value-in-select-statement/</link>
					<comments>https://blogit.create.pt/ricardocosta/2014/11/07/how-to-access-the-previous-row-and-next-row-value-in-select-statement/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Fri, 07 Nov 2014 11:09:37 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Sql]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">http://blogit.create.pt/ricardocosta/?p=741</guid>

					<description><![CDATA[<p>LAG &#8211; http://msdn.microsoft.com/en-us/library/hh231256.aspx USE AdventureWorks2012; GO SELECT BusinessEntityID, YEAR(QuotaDate) AS SalesYear, SalesQuota AS CurrentQuota, LAG(SalesQuota, 1,0) OVER (ORDER BY YEAR(QuotaDate)) AS PreviousQuota FROM Sales.SalesPersonQuotaHistory WHERE BusinessEntityID = 275 and YEAR(QuotaDate) IN ('2005','2006'); LEAD &#8211; http://msdn.microsoft.com/en-us/library/hh213125.aspx USE AdventureWorks2012; GO SELECT BusinessEntityID, YEAR(QuotaDate) AS SalesYear, SalesQuota AS CurrentQuota, LEAD(SalesQuota, 1,0) OVER (ORDER BY YEAR(QuotaDate)) AS NextQuota FROM Sales.SalesPersonQuotaHistory WHERE [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2014/11/07/how-to-access-the-previous-row-and-next-row-value-in-select-statement/">How to Access the Previous Row and Next Row value in SELECT statement?</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>LAG</strong> &#8211; <a id="x_lnk563653" href="http://msdn.microsoft.com/en-us/library/hh231256.aspx" target="_blank"></a><a id="x_lnk618706" title="http://msdn.microsoft.com/en-us/library/hh231256.aspx&lt;br /&gt;&lt;br /&gt;
Ctrl+click or tap to follow link" href="http://msdn.microsoft.com/en-us/library/hh231256.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/hh231256.aspx</a></p>
<pre>USE AdventureWorks2012;
GO
SELECT BusinessEntityID, YEAR(QuotaDate) AS SalesYear, SalesQuota AS CurrentQuota, 
       LAG(SalesQuota, 1,0) OVER (ORDER BY YEAR(QuotaDate)) AS PreviousQuota
FROM Sales.SalesPersonQuotaHistory
WHERE BusinessEntityID = 275 and YEAR(QuotaDate) IN ('2005','2006');</pre>
<p><strong>LEAD</strong> &#8211; <a id="x_lnk627900" href="http://msdn.microsoft.com/en-us/library/hh213125.aspx" target="_blank"></a><a id="x_lnk774047" href="http://msdn.microsoft.com/en-us/library/hh213125.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/hh213125.aspx</a></p>
<pre>USE AdventureWorks2012;
GO
SELECT BusinessEntityID, YEAR(QuotaDate) AS SalesYear, SalesQuota AS CurrentQuota, 
    LEAD(SalesQuota, 1,0) OVER (ORDER BY YEAR(QuotaDate)) AS NextQuota
FROM Sales.SalesPersonQuotaHistory
WHERE BusinessEntityID = 275 and YEAR(QuotaDate) IN ('2005','2006');</pre>
<p>SQL SERVER 2012 and 2014</p>
<p>&nbsp;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2014/11/07/how-to-access-the-previous-row-and-next-row-value-in-select-statement/">How to Access the Previous Row and Next Row value in SELECT statement?</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2014/11/07/how-to-access-the-previous-row-and-next-row-value-in-select-statement/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Strange behavior with &#8220;Merge Join&#8221; in SSIS</title>
		<link>https://blogit.create.pt/ricardocosta/2014/10/24/strange-behavior-with-merge-join-in-ssis/</link>
					<comments>https://blogit.create.pt/ricardocosta/2014/10/24/strange-behavior-with-merge-join-in-ssis/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Fri, 24 Oct 2014 10:04:36 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">http://blogit.create.pt/ricardocosta/?p=691</guid>

					<description><![CDATA[<p>If the datasources of the Merge Join block in SSIS aren&#8217;t sorted the merge will not work correctly. Strange behavior will occur if the datasources aren&#8217;t sorted equal by the same key. http://msdn.microsoft.com/en-us/library/ms141775.aspx &#8220;The Merge Join Transformation requires sorted data for its inputs.&#8221; http://msdn.microsoft.com/en-us/library/ms137653.aspx</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2014/10/24/strange-behavior-with-merge-join-in-ssis/">Strange behavior with &#8220;Merge Join&#8221; in SSIS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If the datasources of the Merge Join block in SSIS aren&#8217;t sorted the merge will not work correctly.</p>
<p><a href="http://blogit-create.com/wp-content/uploads/2014/10/mergejoin.png"><img decoding="async" class="alignnone size-full wp-image-701" src="http://blogit-create.com/wp-content/uploads/2014/10/mergejoin.png" alt="Merge Join" width="148" height="62" /></a></p>
<p>Strange behavior will occur if the datasources aren&#8217;t sorted equal by the same key.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms141775.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms141775.aspx</a></p>
<p><em>&#8220;The Merge Join Transformation requires sorted data for its inputs.&#8221;</em></p>
<p><a title="Sort Data for the Merge and Merge Join Transformation" href="http://msdn.microsoft.com/en-us/library/ms137653.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms137653.aspx</a></p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2014/10/24/strange-behavior-with-merge-join-in-ssis/">Strange behavior with &#8220;Merge Join&#8221; in SSIS</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2014/10/24/strange-behavior-with-merge-join-in-ssis/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint Tunning Session</title>
		<link>https://blogit.create.pt/miguelisidoro/2014/10/14/sharepoint-tunning-session/</link>
					<comments>https://blogit.create.pt/miguelisidoro/2014/10/14/sharepoint-tunning-session/#respond</comments>
		
		<dc:creator><![CDATA[Miguel Isidoro]]></dc:creator>
		<pubDate>Tue, 14 Oct 2014 21:54:32 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[SharePoint 2013]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">http://blogit.create.pt/miguelisidoro/?p=1191</guid>

					<description><![CDATA[<p>Last week I delivered a session at SharePoint Portuguese Community 36th event. My session was entitled SharePoint Tunning, focused on techniques used to improve the performance of a SharePoint farm. The main topics of the session were: SQL Server performance tips (most of the presentation, since performance in SharePoint is guaranteed mainly at SQL Server level) SharePoint farm performance tips SharePoint development tips You [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2014/10/14/sharepoint-tunning-session/">SharePoint Tunning Session</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Last week I delivered a session at <strong><a href="http://www.sharepointpt.org/archive/2014/10/09/spugptmeeting36.aspx" target="_blank" rel="noopener">SharePoint Portuguese Community 36th event</a></strong>.</p>
<p>My session was entitled <strong>SharePoint Tunning</strong>, focused on techniques used to improve the performance of a SharePoint farm. The main topics of the session were:</p>
<ul>
<li>SQL Server performance tips (most of the presentation, since performance in SharePoint is guaranteed mainly at SQL Server level)</li>
<li>SharePoint farm performance tips</li>
<li>SharePoint development tips</li>
</ul>
<p>You can find the slide deck <strong><a href="http://www.slideshare.net/miguellopesisidoro/20141011-spug-pt-sharepoint-tunning" target="_blank" rel="noopener">here</a></strong>. I hope you understand Portuguese since the slide deck is in my mother language :).</p>
<p>Related Links:</p>
<ul>
<li><a href="http://www.sharepointpt.org/" target="_blank" rel="noopener">Portuguese SharePoint Community web site</a></li>
<li><a href="http://www.slideshare.net/miguellopesisidoro" target="_blank" rel="noopener">My SlideShare web site</a></li>
<li><a href="http://www.create.pt/" target="_blank" rel="noopener"><strong>|create|it| </strong>web site</a></li>
</ul>
<p>If you are a SharePoint administrator or a SharePoint developer who wants to learn more about how to install a SharePoint farm in an automated way using PowerShell, I invite you to click <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-1/" target="_blank" rel="noopener">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-2/" target="_blank" rel="noopener">here</a>. The articles use AutoSPInstaller with a SharePoint 2016 farm but AutoSPInstaller support for SharePoint 2019 was already announced!</p>
<p>If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these <a href="https://blogit.create.pt////miguelisidoro/2018/10/17/sharepoint-and-office-365-learning-resources/" target="_blank" rel="noopener">learning resources</a>.</p>
<p><strong>UPDATE 01/11/2018:</strong></p>
<p>If you or your customers are not ready to move entirely to the Cloud and Office 365, a hybrid scenario could be an interesting scenario and SharePoint 2019 RTM was recently announced with improved hybrid support! To learn all about SharePoint 2019 and all its features, click <a href="https://blogit.create.pt////miguelisidoro/2018/11/01/meet-the-new-modern-sharepoint-server-sharepoint-2019-rtm-is-here/" target="_blank" rel="noopener">here</a>.</p>
<p><strong>UPDATE 21/11/2018:</strong></p>
<p>If you want to know all about the latest SharePoint and Office 365 announcements from Ignite and some more recent announcements, including Microsoft Search, What’s New to Build a Modern Intranet with SharePoint in Office 365, Deeper Integration between Microsoft Teams and SharePoint and the latest news on SharePoint development, click <a href="https://blogit.create.pt////miguelisidoro/2018/11/21/whats-new-for-sharepoint-and-office-365-after-microsoft-ignite-2018/" target="_blank" rel="noopener">here</a>.</p>
<p>Happy SharePointing!</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2014/10/14/sharepoint-tunning-session/">SharePoint Tunning Session</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/miguelisidoro/2014/10/14/sharepoint-tunning-session/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Reset Identity value</title>
		<link>https://blogit.create.pt/antoniovargas/2010/01/12/reset-identity-value/</link>
					<comments>https://blogit.create.pt/antoniovargas/2010/01/12/reset-identity-value/#respond</comments>
		
		<dc:creator><![CDATA[António Vargas]]></dc:creator>
		<pubDate>Tue, 12 Jan 2010 10:55:00 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/antoniovargas/?p=201</guid>

					<description><![CDATA[<p>Today, i needed to reset the Identity value for one column in the SQL Server database. I used the following commando to view the current identity value: DBCC CHECKIDENT (&#039;TableName1&#039;, NORESEED) and then, it returned the following message: Checking identity information: current identity value &#039;53&#039;, current column value &#039;53&#039;. DBCC execution completed. If DBCC printed [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/antoniovargas/2010/01/12/reset-identity-value/">Reset Identity value</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Today, i needed to reset the Identity value for one column in the SQL Server database.</p>
<p>I used the following commando to view the current identity value:</p>
<p><strong>DBCC CHECKIDENT (&#039;TableName1&#039;, NORESEED)</strong></p>
<p>and then, it returned the following message:</p>
<p><em>Checking identity information: current identity value &#039;53&#039;, current column value &#039;53&#039;.   <br />DBCC execution completed. If DBCC printed error messages, contact your system administrator.</em></p>
<p>Finally, after I&#039;ve checked the current identity value, i needed to reset this value and I&#039;ve used the following command:</p>
<p><strong>DBCC CHECKIDENT (TableName1, RESEED, 0)</strong></p>
<p>and then, it returned the following message:&nbsp; </p>
<p><em>Checking identity information: current identity value &#039;53&#039;, current column value &#039;0&#039;.   <br />DBCC execution completed. If DBCC printed error messages, contact your system administrator.</em></p>
<p>The post <a href="https://blogit.create.pt/antoniovargas/2010/01/12/reset-identity-value/">Reset Identity value</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/antoniovargas/2010/01/12/reset-identity-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Full-Text Search: Actualizar múltiplos cátalogos de pesquisa</title>
		<link>https://blogit.create.pt/miguelisidoro/2007/06/24/full-text-search-actualizar-mltiplos-ctalogos-de-pesquisa/</link>
					<comments>https://blogit.create.pt/miguelisidoro/2007/06/24/full-text-search-actualizar-mltiplos-ctalogos-de-pesquisa/#respond</comments>
		
		<dc:creator><![CDATA[Miguel Isidoro]]></dc:creator>
		<pubDate>Sun, 24 Jun 2007 12:07:16 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/miguelisidoro/?p=611</guid>

					<description><![CDATA[<p>Introdução O Sql Server possui um mecanismo de pesquisa de texto com base na indexação de colunas de tabelas numa base de dados chamado Full-Text Search. Este mecanismo de pesquisa utiliza um catálogo de pesquisa, criado no file system, e tem uma série de vantagens relativamente às pesquisas que utilizam o predicado LIKE, entre as [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2007/06/24/full-text-search-actualizar-mltiplos-ctalogos-de-pesquisa/">Full-Text Search: Actualizar múltiplos cátalogos de pesquisa</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Introdução<br />
</strong></p>
<p>O Sql Server possui um mecanismo de pesquisa de texto com base na indexação de colunas de tabelas numa base de dados chamado Full-Text Search. Este mecanismo de pesquisa utiliza um catálogo de pesquisa, criado no <em>file system</em>, e tem uma série de vantagens relativamente às pesquisas que utilizam o predicado LIKE, entre as quais se destacam:
</p>
<ul>
<li>Mecanismo de pesquisa mais rápido, nomeadamente em tabelas com um grande volume de dados;
</li>
<li>Possibilidade de indexar colunas do tipo <em>image</em>. Desta forma, torna-se possível efectuar pesquisa de texto dentro de documentos armazenados em base de dados;
</li>
<li>Possibilidade de realizar pesquisas específicas para um idioma;
</li>
<li>Possibilidade de incluir <em>noise words</em> (por idioma), um conjunto de palavras que são ignoradas numa query utilizando FTS.
</li>
</ul>
<p>Tal como referido anteriormente, o Full-Text Search usa um catálogo de pesquisa, criado no <em>file system</em>, para cada base de dados, onde são definidas as tabelas e respectivas colunas a indexar. Depois de criado o catálogo e para poderem ser efectuadas pesquisas sobre o mesmo, deve-se proceder à sua população. Existem duas opções de população de um catálogo de pesquisa:
</p>
<ul>
<li><strong>Full Population</strong> – efectua uma população completa do catálogo de pesquisa, ou seja, são criadas entradas no índice para todas as linhas de dados das tabelas do catálogo. Deve ser executada uma vez, na primeira população do catálogo;
</li>
<li><strong>Incremental Population</strong> – efectua a actualização do catálogo com base nas alterações efectuadas desde a última população às tabelas que fazem parte do catálogo. Deve ser executada periodicamente, tipicamente 1 vez por dia.
</li>
</ul>
<p>Para se proceder à actualização do catálogo de pesquisa com uma determinada periodicidade, deve ser criado um <em>schedule</em>. Este procedimento dará origem à criação de um <em>Job</em> (é necessário ter o serviço Sql Server Agent a correr) que na periodicidade definida no <em>schedule</em> executará uma <em>stored procedure</em> de sistema (sp_fulltext_catalog) para actualizar o catálogo. O exemplo seguinte utiliza a base de dados Northwind e um catálogo chamado Northwind_Catalog:
</p>
<p>use Northwind exec sp_fulltext_catalog &#8216; Northwind_Catalog &#8216;,  &#8216;start_incremental&#8217;
</p>
<p><strong><br />Actualização de múltiplos cátalogos de pesquisa<br />
</strong></p>
<p>O exemplo apresentado anteriormente demonstra a utilização de catálogos de pesquisa Full-Text Search numa base de dados Sql Server. Num cenário de um sistema de informação que possua várias bases de dados de conteúdos, controlados por uma base de dados de configuração, e se pretenda actualizar de forma periódica os catálogos de pesquisa de todas as bases de dados, pode ser actualizado um mecanismo idêntico ao apresentado de seguida.
</p>
<p>O exemplo seguinte pressupõe a existência de uma base de dados de configuração onde é armazenada a informação sobre todas as bases de dados de conteúdos existentes no sistema. Esta informação é guardada numa tabela chamada <strong>ContentDatabases</strong> com a seguinte estrutura:
</p>
<ul>
<li>ID – campo identity (chave primária da tabela)
</li>
<li>Name – campo onde é guardada a informação do nome da base de dados de conteúdos
</li>
<li>&#8230;
</li>
</ul>
<p>O nome do catálogo de pesquisa em cada base de dados de conteúdos é <strong>ContentDatabase_Catalog</strong>.
</p>
<p>A actualização dos catálogos de pesquisa será efectuada por intermédio de uma <em>stored procedure</em> criada na base de dados de configuração chamada <strong>UpdateContentDatabasesCatalogs</strong>. A <em>stored procedure</em> é criada da seguinte forma:
</p>
<p>CREATE PROCEDURE [dbo].[UpdateContentDatabasesCatalogs]<br />AS<br />    DECLARE @ID int<br />    DECLARE @Name nvarchar(50)<br />    DECLARE @sqlStatement nvarchar(250)
</p>
<p>    SELECT @ID = MIN(ID) FROM [ContentDatabases]
</p>
<p>    while @ID is not null<br />    begin<br />        SELECT @Name = [Name] FROM [ContentDatabases] WHERE ID = @ID<br />        SET @sqlStatement = &#8216;use &#8216; + @Name + &#8216; exec sp_fulltext_catalog N&#8221;ContentDatabase_Catalog&#8221;, N&#8221;start_incremental&#8221;&#8217;<br />        exec sp_executesql @sqlStatement<br />        SELECT @ID = min(ID) FROM [ContentDatabases] WHERE ID &gt; @ID<br />    end<br />GO
</p>
<p>Para finalizar, deve ser criado um <em>Job</em> no Sql Server para executar esta <em>stored procedure</em> com a periodicidade desejada.
</p>
<p><strong><br />Recursos<br />
</strong></p>
<p>Para saberem mais sobre Full-Text Search podem consultar os seguintes artigos:
</p>
<ul>
<li><a href="http://technet.microsoft.com/en-us/library/ms345119.aspx" target="_blank">SQL Server 2005 Full-Text Search: Internals and Enhancements</a>
		</li>
<li><a href="http://technet.microsoft.com/en-us/library/ms142541.aspx" target="_blank">Full-Text Search Architecture</a>
		</li>
<li><a href="http://technet.microsoft.com/en-us/library/ms142557.aspx" target="_blank">Administering Full-Text Search</a>
		</li>
</ul>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2007/06/24/full-text-search-actualizar-mltiplos-ctalogos-de-pesquisa/">Full-Text Search: Actualizar múltiplos cátalogos de pesquisa</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/miguelisidoro/2007/06/24/full-text-search-actualizar-mltiplos-ctalogos-de-pesquisa/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Recursive Queries in SQL Server 2005</title>
		<link>https://blogit.create.pt/ricardocosta/2007/05/24/recursive-queries-in-sql-server-2005/</link>
					<comments>https://blogit.create.pt/ricardocosta/2007/05/24/recursive-queries-in-sql-server-2005/#respond</comments>
		
		<dc:creator><![CDATA[Ricardo Costa]]></dc:creator>
		<pubDate>Thu, 24 May 2007 09:53:00 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Sql Server 2005]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/ricardocosta/?p=521</guid>

					<description><![CDATA[<p>For building recursive queries In SQL Server 2005 we have to use a new functionality called Common Table Expressions. Let&#039;s see how we can retrieve all the employees that report to a manager (ManagerID = 3) in the AdventureWorks database sample: WITH CTE (EmployeeID, FullName, Title, ManagerID) AS ( SELECT E.EmployeeID, C.FirstName + &#039; &#039; [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/05/24/recursive-queries-in-sql-server-2005/">Recursive Queries in SQL Server 2005</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>For building recursive queries In SQL Server 2005 we have to use a new functionality called <a href="http://msdn2.microsoft.com/en-us/library/ms190766.aspx">Common Table Expressions</a>.
</p>
<p>Let&#039;s see how we can retrieve all the employees that report to a manager (ManagerID = 3) in the AdventureWorks database sample:
</p>
<p><span style="font-size: 9pt">WITH CTE (EmployeeID, FullName, Title, ManagerID) AS<br /> (</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />   WHERE E.EmployeeID = 3<br />  UNION ALL</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />     INNER JOIN CTE ON E.ManagerID = CTE.EmployeeID<br /> )</p>
<p>SELECT * FROM CTE</span><em><br />
		</em></p>
<p> This query returns the following results:
</p>
<div style="margin-left: 4pt">
<table border="0" style="border-collapse: collapse">
<col style="width: 97px">
<col style="width: 133px">
<col style="width: 241px">
<col style="width: 89px">
<tbody valign="top">
<tr style="height: 20px">
<td style="border-style: solid none solid solid;border-color: black -moz-use-text-color black black;border-width: 0.5pt medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>EmployeeID</strong></p>
</td>
<td style="border-style: solid none;border-color: black -moz-use-text-color;border-width: 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>Full Name</strong></p>
</td>
<td style="border-style: solid none;border-color: black -moz-use-text-color;border-width: 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>Title</strong></p>
</td>
<td style="border-style: solid solid solid none;border-color: black black black -moz-use-text-color;border-width: 0.5pt 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>ManagerID</strong></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">3</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Roberto Tamburello</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Engineering Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">12</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">4</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Rob Walters</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Senior Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">9</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Gail Erickson</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">11</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Jossef Goldberg</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">158</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Dylan Miller</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Research and Development Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">263</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Ovidiu Cracium</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Senior Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">267</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Michael Sullivan</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Senior Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">270</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Sharon Salavaria</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">5</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Thierry D&#039;Hers</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">263</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">265</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Janice Galvin</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">263</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">79</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Diane Margheim</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Research and Development Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">114</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Gigi Matthew</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Research and Development Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">217</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Michael Raheem</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Research and Development Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>If we don&#039;t want to return the manager we change the WHERE clause:
</p>
<p><span style="font-size: 9pt">WITH CTE (EmployeeID, FullName, Title, ManagerID) AS<br /> (</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />   WHERE E.ManagerID = 3<br />  UNION ALL</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />     INNER JOIN CTE ON E.ManagerID = CTE.EmployeeID<br /> )</p>
<p>SELECT * FROM CTE</span>
	</p>
<p>And the results are:
</p>
<div>
<table border="0" style="border-collapse: collapse">
<col style="width: 97px">
<col style="width: 133px">
<col style="width: 241px">
<col style="width: 91px">
<tbody valign="top">
<tr style="height: 20px">
<td style="border: 0.5pt solid black;padding-left: 7px;padding-right: 7px">
<p><strong>EmployeeID</strong></p>
</td>
<td style="border-style: solid solid solid none;border-color: black black black -moz-use-text-color;border-width: 0.5pt 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><strong>Full Name</strong></p>
</td>
<td style="border-style: solid solid solid none;border-color: black black black -moz-use-text-color;border-width: 0.5pt 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><strong>Title</strong></p>
</td>
<td style="border-style: solid solid solid none;border-color: black black black -moz-use-text-color;border-width: 0.5pt 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><strong>ManagerID</strong></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">4</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Rob Walters</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Senior Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">9</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Gail Erickson</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">11</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Jossef Goldberg</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">158</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Dylan Miller</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Research and Development Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">263</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Ovidiu Cracium</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Senior Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">267</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Michael Sullivan</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Senior Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">270</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Sharon Salavaria</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Design Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">5</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Thierry D&#039;Hers</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">263</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">265</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Janice Galvin</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Tool Designer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">263</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">79</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Diane Margheim</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Research and Development Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">114</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Gigi Matthew</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Research and Development Engineer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none solid solid;border-color: -moz-use-text-color black black;border-width: medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">217</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Michael Raheem</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p><span style="color: black">Research and Development Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px">
<p style="text-align: right"><span style="color: black">158</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>If we want to get all the employees that an employee reports to, we just have to change the INNER JOIN order:
</p>
<p><em><span style="font-size: 9pt">WITH CTE (EmployeeID, FullName, Title, ManagerID) AS<br /> (</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />   WHERE E.EmployeeID = 3<br />  UNION ALL</p>
<p>  SELECT E.EmployeeID, C.FirstName + &#039; &#039; + C.LastName FullName, E.Title, E.ManagerID<br />   FROM HumanResources.Employee E<br />    INNER JOIN Person.Contact C ON E.ContactID = C.ContactID<br />     INNER JOIN CTE ON E.EmployeeID = CTE.ManagerID<br /> )</p>
<p>SELECT * FROM CTE</span><br />
		</em></p>
<p>And the employees that the employee (EmployeeID = 3) reports to are:
</p>
<div style="margin-left: 4pt">
<table border="0" style="border-collapse: collapse">
<col style="width: 97px">
<col style="width: 133px">
<col style="width: 241px">
<col style="width: 91px">
<tbody valign="top">
<tr style="height: 20px">
<td style="border-style: solid none solid solid;border-color: black -moz-use-text-color black black;border-width: 0.5pt medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>EmployeeID</strong></p>
</td>
<td style="border-style: solid none;border-color: black -moz-use-text-color;border-width: 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>Full Name</strong></p>
</td>
<td style="border-style: solid none;border-color: black -moz-use-text-color;border-width: 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>Title</strong></p>
</td>
<td style="border-style: solid solid solid none;border-color: black black black -moz-use-text-color;border-width: 0.5pt 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><strong>ManagerID</strong></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">3</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Roberto Tamburello</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Engineering Manager</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">12</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">12</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Terri Duffy</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Vice President of Engineering</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">109</span></p>
</td>
</tr>
<tr style="height: 20px">
<td style="border-style: none none solid solid;border-color: -moz-use-text-color -moz-use-text-color black black;border-width: medium medium 0.5pt 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p style="text-align: right"><span style="color: black">109</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Ken S&aacute;nchez</span></p>
</td>
<td style="border-style: none none solid;border-color: -moz-use-text-color -moz-use-text-color black;border-width: medium medium 0.5pt;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">Chief Executive Officer</span></p>
</td>
<td style="border-style: none solid solid none;border-color: -moz-use-text-color black black -moz-use-text-color;border-width: medium 0.5pt 0.5pt medium;padding-left: 7px;padding-right: 7px" valign="bottom">
<p><span style="color: black">NULL</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>The post <a href="https://blogit.create.pt/ricardocosta/2007/05/24/recursive-queries-in-sql-server-2005/">Recursive Queries in SQL Server 2005</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/ricardocosta/2007/05/24/recursive-queries-in-sql-server-2005/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
