<?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>Parameter &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/parameter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Tue, 04 Jul 2017 18:45:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server 2016: Use OPENJSON() to extract JSON data from Input Parameter</title>
		<link>https://www.dbrnd.com/2017/07/sql-server-2016-use-openjson-to-extract-json-data-from-input-parameter/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 18 Jul 2017 16:16:00 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[OPENJSON]]></category>
		<category><![CDATA[Parameter]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5636</guid>

					<description><![CDATA[SQL Server 2016 introduced the support of JSON and added many new functions in the recent CTP3 version of SQL Server 2016. Now, we have OPENJSON() to extract JSON data into a tabular format. If you are passing JSON document as an input parameter in Stored Procedure, you can use OPENJSON() to extract the value [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fsql-server-2016-use-openjson-to-extract-json-data-from-input-parameter%2F&#038;title=SQL%20Server%202016%3A%20Use%20OPENJSON%28%29%20to%20extract%20JSON%20data%20from%20Input%20Parameter" data-a2a-url="https://www.dbrnd.com/2017/07/sql-server-2016-use-openjson-to-extract-json-data-from-input-parameter/" data-a2a-title="SQL Server 2016: Use OPENJSON() to extract JSON data from Input Parameter"></a></p><p>SQL Server 2016 introduced the support of JSON and added many new functions in the recent CTP3 version of SQL Server 2016.</p>
<blockquote><p>Now, we have OPENJSON() to extract JSON data into a tabular format. If you are passing JSON document as an input parameter in Stored Procedure, you can use OPENJSON() to extract the value of JSON parameter.</p></blockquote>
<blockquote class="wp-embedded-content" data-secret="dalsxXM11a"><p><a href="https://www.dbrnd.com/2016/12/sql-server-2016-introduced-json-support-to-store-and-retrieve-json-document-isjson-json_value-json_query/">SQL Server 2016: Introduced JSON support, to store and retrieve JSON document</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/12/sql-server-2016-introduced-json-support-to-store-and-retrieve-json-document-isjson-json_value-json_query/embed/#?secret=dalsxXM11a" data-secret="dalsxXM11a" width="600" height="338" title="&#8220;SQL Server 2016: Introduced JSON support, to store and retrieve JSON document&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Please check the below sample use of OPENJSON():</strong></p>
<p><strong>Sample 1:</strong></p><pre class="crayon-plain-tag">DECLARE @SampleJson NVARCHAR(2000) = 
N'{
 "ID" : 1,
 "Name": "Anvesh",
 "Blog": "dbrnd.com",
 "DOB": "1988-01-26",
 "Position": "Database Engineer"
 }'
 GO

SELECT * FROM OPENJSON(@SampleJson)
GO</pre><p>
<img decoding="async" class="alignnone size-full wp-image-5639" src="https://www.dbrnd.com/wp-content/uploads/2017/07/OpenJSON.png" alt="SQL Open Json " width="205" height="123" /></p>
<p><strong>Sample 2:</strong></p><pre class="crayon-plain-tag">DECLARE @SampleJson NVARCHAR(2000) = 
N'[{
 "ID" : 8,
 "Name": "Anvesh",
 "Blog": "dbrnd.com",
 "DOB": "1988-01-26",
 "Position": "Database Engineer"
 }
 ,{
 "ID" : 10,
 "Name": "Roy",
 "Blog": "abc.com",
 "DOB": "1920-06-8",
 "Position": "Database Developer"
 }]'
 GO

 SELECT * FROM OPENJSON(@SampleJson)
 with
 (
	ID INT, 
	Name NVARCHAR(2000),
	Blog NVARCHAR(20),
	DOB DATE,
	Position NVARCHAR(20)
 )
 GO</pre><p>
<img decoding="async" class="alignnone size-full wp-image-5640" src="https://www.dbrnd.com/wp-content/uploads/2017/07/OpenJSON2.png" alt="SQL Openjson()" width="340" height="71" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Increase Query Performance using a Forced Parameterization</title>
		<link>https://www.dbrnd.com/2016/12/sql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 27 Dec 2016 17:39:30 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Execution Plan]]></category>
		<category><![CDATA[Forced Parameterization]]></category>
		<category><![CDATA[OUT Parameters]]></category>
		<category><![CDATA[Parameter]]></category>
		<category><![CDATA[parse query plan]]></category>
		<category><![CDATA[query performance]]></category>
		<category><![CDATA[simple parameterization]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4146</guid>

					<description><![CDATA[Since SQL Server 2005, we have a concept of Forced Parameterization of SQL Query. It looks like a very old concept, but the use of Forced Parameterization improves the performance of Query Optimizer which responsible for the best execution plan. SQL Server provides two types of query parameterization, one is Simple Parameterization and second is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&amp;linkname=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F12%2Fsql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization%2F&#038;title=SQL%20Server%3A%20Increase%20Query%20Performance%20using%20a%20Forced%20Parameterization" data-a2a-url="https://www.dbrnd.com/2016/12/sql-server-increase-query-performance-using-a-forced-parameterization-simple-parameterization/" data-a2a-title="SQL Server: Increase Query Performance using a Forced Parameterization"></a></p><p>Since SQL Server 2005, we have a concept of Forced Parameterization of SQL Query.</p>
<blockquote><p>It looks like a very old concept, but the use of Forced Parameterization improves the performance of Query Optimizer which responsible for the best execution plan.</p></blockquote>
<blockquote><p>SQL Server provides two types of query parameterization, one is Simple Parameterization and second is Forced Parameterization.</p></blockquote>
<p><strong>Why it is important and How it works?</strong></p>
<blockquote><p>When you are executing any query, SQL Server Query Optimizer analyzes your query and prepares the best execution plan for it.</p></blockquote>
<blockquote><p>If you are executing the same query again, previously generated execution plan may use for the same query. We can also say that It caches your query execution plan.</p>
<p>It is doing this using a Simple Parameterization which is default in SQL Server.</p></blockquote>
<blockquote><p>Let me add one more thing,<br />
Your frequent SQL Query uses the cache query plan, but what If you change the value in WHERE clause.</p>
<p>If you are changing just column filter value in WHERE clause, It uses the cache query plan and If you are modifying your parameter list, It requires to generate a new query plan.</p>
<p>This is about the Simple Parameterization.</p></blockquote>
<p><strong>You can see in the below image:</strong></p>
<blockquote><p>I have executed two different queries with passing different values for TrackingEventID.</p></blockquote>
<blockquote><p>But You can see TrackingEventID = @1 in query execution plan, means It uses same query plan for both the query which increase your query performance.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4152 size-full" title="sql server simple parameterization" src="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization.png" alt="sql server simple parameterization" width="558" height="341" srcset="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization.png 558w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization-300x183.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization-150x92.png 150w" sizes="auto, (max-width: 558px) 100vw, 558px" /></p></blockquote>
<p><strong>Now check below image:</strong></p>
<blockquote><p>I have used ISNULL() in query and It skipped to put parameter in the query of execution plan.<br />
You can see static date value instead of parameter values.</p></blockquote>
<blockquote><p>If you are executing this kind of queries frequently, It prepares and generates an execution plan every time which decreases the query performance.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4153 size-full" title="sql server simple parameterization without parameter" src="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization2.png" alt="sql server simple parameterization without parameter" width="756" height="236" srcset="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization2.png 756w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization2-300x94.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization2-750x234.png 750w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerSimpleParameterization2-150x47.png 150w" sizes="auto, (max-width: 756px) 100vw, 756px" /></p>
</blockquote>
<p><strong>Now, enable the Force Parameterization and check the same query.<br />
</strong></p>
<blockquote><p>You can check below image where you can see parameter values instead of static date value.</p></blockquote>
<blockquote><p>Once you enable Force Parameterization, It forcefully adds the parameter in the query of execution plan.</p>
<p>Which improves the query performance by reducing the cost of preparing and compiling an execution plan again and again.</p></blockquote>
<blockquote><p>But we should also take care about this because It might generate SQL Parameter Sniffing Issue so we should keep database statistics up to date.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4150 size-full" title="sql server force parameterization" src="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerForceParameterization.png" alt="sql server force parameterization" width="641" height="322" srcset="https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerForceParameterization.png 641w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerForceParameterization-300x151.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/12/SQLServerForceParameterization-150x75.png 150w" sizes="auto, (max-width: 641px) 100vw, 641px" /></p></blockquote>
<p><strong>Script to change the database in Forced Parameterization:<br />
</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE Database_Name
SET PARAMETERIZATION FORCED
GO</pre> </p>
<p><strong>Script to change the database in Simple Parameterization:<br />
</strong></p>
<pre class="crayon-plain-tag">ALTER DATABASE Database_Name
SET PARAMETERIZATION Simple
GO</pre> </p>
<p><strong>Other related articles:</strong></p>
<blockquote class="wp-embedded-content" data-secret="tkyOSwf91D"><p><a href="https://www.dbrnd.com/2016/12/sql-server-the-importance-of-statistics-and-why-it-is-important/">SQL Server: The Importance of Statistics and Why It is important</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/12/sql-server-the-importance-of-statistics-and-why-it-is-important/embed/#?secret=tkyOSwf91D" data-secret="tkyOSwf91D" width="600" height="338" title="&#8220;SQL Server: The Importance of Statistics and Why It is important&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="y1mqbDz6n7"><p><a href="https://www.dbrnd.com/2015/05/sql-server-parameter-sniffing/">SQL Server Parameter Sniffing</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/sql-server-parameter-sniffing/embed/#?secret=y1mqbDz6n7" data-secret="y1mqbDz6n7" width="600" height="338" title="&#8220;SQL Server Parameter Sniffing&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
