<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Avoid Using Function in WHERE Clause &#8211; Scan to Seek</title>
	<atom:link href="http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sat, 25 May 2013 15:33:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Nikhil</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-471540</link>
		<dc:creator><![CDATA[Nikhil]]></dc:creator>
		<pubDate>Wed, 08 May 2013 19:27:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-471540</guid>
		<description><![CDATA[Can you please tell me other alternate solutions instead of using functions in where clause to improve performance]]></description>
		<content:encoded><![CDATA[<p>Can you please tell me other alternate solutions instead of using functions in where clause to improve performance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Srivastava</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-470462</link>
		<dc:creator><![CDATA[Ashish Srivastava]]></dc:creator>
		<pubDate>Tue, 07 May 2013 06:05:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-470462</guid>
		<description><![CDATA[Thanks Sir...
i use mostly with where clause but not understand why result set is too slow, but now i know what effects my query.

-- Ashish]]></description>
		<content:encoded><![CDATA[<p>Thanks Sir&#8230;<br />
i use mostly with where clause but not understand why result set is too slow, but now i know what effects my query.</p>
<p>&#8211; Ashish</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dony van Vliet</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-440302</link>
		<dc:creator><![CDATA[Dony van Vliet]]></dc:creator>
		<pubDate>Tue, 19 Mar 2013 17:48:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-440302</guid>
		<description><![CDATA[Your original query does not return all future rows, but all rows from next year and beyond. If that is required you should first compute the start of next year from GETDATE() and then select rows where Date &gt;= @StartOfNextYear. However calculating @StartOfNextYear from GETDATE() is not a trivial task.]]></description>
		<content:encoded><![CDATA[<p>Your original query does not return all future rows, but all rows from next year and beyond. If that is required you should first compute the start of next year from GETDATE() and then select rows where Date &gt;= @StartOfNextYear. However calculating @StartOfNextYear from GETDATE() is not a trivial task.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aryanverma</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-438325</link>
		<dc:creator><![CDATA[aryanverma]]></dc:creator>
		<pubDate>Sat, 16 Mar 2013 10:40:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-438325</guid>
		<description><![CDATA[any simple Definition For these so that i can make anyone easily understand these ?]]></description>
		<content:encoded><![CDATA[<p>any simple Definition For these so that i can make anyone easily understand these ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436840</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 21:10:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436840</guid>
		<description><![CDATA[@Pavan,

If you are expecting future records then the solution would be, 
1. Date &gt; yesterday and Date &lt; tomorrow 
2. Date between yesterday + 1 sec and tomorrow -1sec (Warning: between includes limits also)
3. Date = @Today]]></description>
		<content:encoded><![CDATA[<p>@Pavan,</p>
<p>If you are expecting future records then the solution would be,<br />
1. Date &gt; yesterday and Date &lt; tomorrow<br />
2. Date between yesterday + 1 sec and tomorrow -1sec (Warning: between includes limits also)<br />
3. Date = @Today</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajesh</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436477</link>
		<dc:creator><![CDATA[Rajesh]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 05:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436477</guid>
		<description><![CDATA[HI, 
Just to add further information  This  Index Seek  behavior is having because we have selected the columns on which the indexes are already  created .
Suppose if you select any other column in addition to the above 3 columns then the query would be INDEX SCAN .In that we should go for Included NON Clustered INDEX . In that case it would give you index seek instead of index scan.]]></description>
		<content:encoded><![CDATA[<p>HI,<br />
Just to add further information  This  Index Seek  behavior is having because we have selected the columns on which the indexes are already  created .<br />
Suppose if you select any other column in addition to the above 3 columns then the query would be INDEX SCAN .In that we should go for Included NON Clustered INDEX . In that case it would give you index seek instead of index scan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sai Pavan</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436460</link>
		<dc:creator><![CDATA[Sai Pavan]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 04:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436460</guid>
		<description><![CDATA[@Imran,

I agree with what you have suggested. I was looking at a generic solution for this problem. It could be today&#039;s date or a particular date which which we want to check. The solution that you have provided works perfectly fine but the assumption is that there are no records of future date other than today. 

Thanks for your reply.

Sai Pavan]]></description>
		<content:encoded><![CDATA[<p>@Imran,</p>
<p>I agree with what you have suggested. I was looking at a generic solution for this problem. It could be today&#8217;s date or a particular date which which we want to check. The solution that you have provided works perfectly fine but the assumption is that there are no records of future date other than today. </p>
<p>Thanks for your reply.</p>
<p>Sai Pavan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinkar</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436409</link>
		<dc:creator><![CDATA[Dinkar]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 02:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436409</guid>
		<description><![CDATA[Would it be right to say them NON-SARgable predicates?]]></description>
		<content:encoded><![CDATA[<p>Would it be right to say them NON-SARgable predicates?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436375</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 01:01:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436375</guid>
		<description><![CDATA[@KSP

I don&#039;t know what is your requirement, but to make a generic statement, You cannot have variables in view, but if you have to use variables then got for &quot;table value functions&quot;.

~IM.]]></description>
		<content:encoded><![CDATA[<p>@KSP</p>
<p>I don&#8217;t know what is your requirement, but to make a generic statement, You cannot have variables in view, but if you have to use variables then got for &#8220;table value functions&#8221;.</p>
<p>~IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436374</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 00:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436374</guid>
		<description><![CDATA[@Pavan,

Why do you have to do DATEDIFF = 0 ??

You can do, where Datecolumn &gt; yesterday (greater than yesterday, which means today). Let me know if you need more help.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Pavan,</p>
<p>Why do you have to do DATEDIFF = 0 ??</p>
<p>You can do, where Datecolumn &gt; yesterday (greater than yesterday, which means today). Let me know if you need more help.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flávio Oliveira</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436373</link>
		<dc:creator><![CDATA[Flávio Oliveira]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 00:54:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436373</guid>
		<description><![CDATA[Great post.]]></description>
		<content:encoded><![CDATA[<p>Great post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KSP</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-436069</link>
		<dc:creator><![CDATA[KSP]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 12:50:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-436069</guid>
		<description><![CDATA[Hi,

How do you implement the same in Views?

Can we use variables in Views?]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>How do you implement the same in Views?</p>
<p>Can we use variables in Views?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gatej Alexandru</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-435990</link>
		<dc:creator><![CDATA[Gatej Alexandru]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 10:08:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-435990</guid>
		<description><![CDATA[Hello,

I don&#039;t know how many of you know that this start to happend with SQL 2005 when they change something in the &quot;frunction evaluation mechanism&quot;, Before that you can use function in the where clause without any performance problem.]]></description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I don&#8217;t know how many of you know that this start to happend with SQL 2005 when they change something in the &#8220;frunction evaluation mechanism&#8221;, Before that you can use function in the where clause without any performance problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sqlguru</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-435917</link>
		<dc:creator><![CDATA[sqlguru]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 08:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-435917</guid>
		<description><![CDATA[Leaving getdate() in the where clause causes a call to the function for every row.  For better performance, declare a local variable above the select statement and set it to getdate(), then use that variable in the where clause.

declare @theDate datetime
set @theDate = getdate()]]></description>
		<content:encoded><![CDATA[<p>Leaving getdate() in the where clause causes a call to the function for every row.  For better performance, declare a local variable above the select statement and set it to getdate(), then use that variable in the where clause.</p>
<p>declare @theDate datetime<br />
set @theDate = getdate()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sai Pavan</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-435813</link>
		<dc:creator><![CDATA[Sai Pavan]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 05:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-435813</guid>
		<description><![CDATA[Sir,

I am usually into situations where I have to retrieve rows from a table which are inserted on that day. For that I use DATEDIFF function with equal to 0 between date column and GETDATE(). I cannot use equal to with GETDATE() because I want on that day and not at that moment. I am not able to figure out a way to both improve performance by not using DATEDIFF while achieving the result that I need.

Thanks,
Sai Pavan]]></description>
		<content:encoded><![CDATA[<p>Sir,</p>
<p>I am usually into situations where I have to retrieve rows from a table which are inserted on that day. For that I use DATEDIFF function with equal to 0 between date column and GETDATE(). I cannot use equal to with GETDATE() because I want on that day and not at that moment. I am not able to figure out a way to both improve performance by not using DATEDIFF while achieving the result that I need.</p>
<p>Thanks,<br />
Sai Pavan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mlatab</title>
		<link>http://blog.sqlauthority.com/2013/03/12/sql-server-avoid-using-function-in-where-clause-scan-to-seek/#comment-435790</link>
		<dc:creator><![CDATA[mlatab]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 03:49:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22973#comment-435790</guid>
		<description><![CDATA[thanks for the Excellent, simple and systematic article with a lot of clarity.]]></description>
		<content:encoded><![CDATA[<p>thanks for the Excellent, simple and systematic article with a lot of clarity.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
