<?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; 2005 &#8211; Use of Non-deterministic Function in UDF &#8211; Find Day Difference Between Any Date and Today</title>
	<atom:link href="http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:36:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-201191</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 21 Nov 2011 11:35:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-201191</guid>
		<description><![CDATA[It is not possible to copy those files when the database is live.]]></description>
		<content:encoded><![CDATA[<p>It is not possible to copy those files when the database is live.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: virendra</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-198554</link>
		<dc:creator><![CDATA[virendra]]></dc:creator>
		<pubDate>Fri, 18 Nov 2011 13:02:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-198554</guid>
		<description><![CDATA[Hi Pinal ,

 How can lock my database if any user stole my mdf and ldf file,User not able to attach the file.

Thanks
Mayank................]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal ,</p>
<p> How can lock my database if any user stole my mdf and ldf file,User not able to attach the file.</p>
<p>Thanks<br />
Mayank&#8230;&#8230;&#8230;&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guest</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-182974</link>
		<dc:creator><![CDATA[Guest]]></dc:creator>
		<pubDate>Mon, 24 Oct 2011 17:12:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-182974</guid>
		<description><![CDATA[I have created a UDF that is certainly deterministic. Yet I cannot use that UDF in the definition of a persisted computed column because SQL Server says my function is nondeterministic.]]></description>
		<content:encoded><![CDATA[<p>I have created a UDF that is certainly deterministic. Yet I cannot use that UDF in the definition of a persisted computed column because SQL Server says my function is nondeterministic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalpesh</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-129018</link>
		<dc:creator><![CDATA[Kalpesh]]></dc:creator>
		<pubDate>Fri, 15 Apr 2011 09:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-129018</guid>
		<description><![CDATA[This can be work around

create VIEW vRand
AS
SELECT RAND() AS ‘number’
GO]]></description>
		<content:encoded><![CDATA[<p>This can be work around</p>
<p>create VIEW vRand<br />
AS<br />
SELECT RAND() AS ‘number’<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalpesh</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-129013</link>
		<dc:creator><![CDATA[Kalpesh]]></dc:creator>
		<pubDate>Fri, 15 Apr 2011 08:49:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-129013</guid>
		<description><![CDATA[we can be work around

create VIEW vRand
AS
	SELECT RAND() AS &#039;number&#039;
GO]]></description>
		<content:encoded><![CDATA[<p>we can be work around</p>
<p>create VIEW vRand<br />
AS<br />
	SELECT RAND() AS &#8216;number&#8217;<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-86910</link>
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 12:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-86910</guid>
		<description><![CDATA[Hi,
  Hi i want the result  &#039;Hai Buddy&#039;. But the following query only returns Buddy... And where to use TextPtr and whats its use.........

 
Create Table summa (Samp Text)

insert into summa values(&#039;Hai&#039;)
Insert into summa values(&#039;Buddy&#039;)


select TextPtr(Samp)from summa

declare @txtpt Binary(16)
Select @txtpt=TextPtr(Samp)from summa
ReadText summa.Samp @txtpt 0 5]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
  Hi i want the result  &#8216;Hai Buddy&#8217;. But the following query only returns Buddy&#8230; And where to use TextPtr and whats its use&#8230;&#8230;&#8230;</p>
<p>Create Table summa (Samp Text)</p>
<p>insert into summa values(&#8216;Hai&#8217;)<br />
Insert into summa values(&#8216;Buddy&#8217;)</p>
<p>select TextPtr(Samp)from summa</p>
<p>declare @txtpt Binary(16)<br />
Select @txtpt=TextPtr(Samp)from summa<br />
ReadText summa.Samp @txtpt 0 5</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m0thmanUD</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-51786</link>
		<dc:creator><![CDATA[m0thmanUD]]></dc:creator>
		<pubDate>Mon, 11 May 2009 17:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-51786</guid>
		<description><![CDATA[This is a real pain.  I wanted to use RAND() in a UDF I was putting together to generate random URL keys and hit a brick wall with this.

I know there&#039;s a few workarounds, such as having the RAND in a view, or just using a stored proc instead, but it&#039;s a real pain.  Just can&#039;t understand the logic of banning the RAND function from within a UDF!]]></description>
		<content:encoded><![CDATA[<p>This is a real pain.  I wanted to use RAND() in a UDF I was putting together to generate random URL keys and hit a brick wall with this.</p>
<p>I know there&#8217;s a few workarounds, such as having the RAND in a view, or just using a stored proc instead, but it&#8217;s a real pain.  Just can&#8217;t understand the logic of banning the RAND function from within a UDF!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malar</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-44573</link>
		<dc:creator><![CDATA[Malar]]></dc:creator>
		<pubDate>Sat, 06 Dec 2008 12:28:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-44573</guid>
		<description><![CDATA[how to change only day part with the day what we want in the date?
for example,i need to compute the date(6-dec-08) which is having the day(&#039;6&#039; should be changed) part from a table.]]></description>
		<content:encoded><![CDATA[<p>how to change only day part with the day what we want in the date?<br />
for example,i need to compute the date(6-dec-08) which is having the day(&#8217;6&#8242; should be changed) part from a table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - Function Property - Deterministic or Non-Deterministic Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-38293</link>
		<dc:creator><![CDATA[SQL SERVER - Function Property - Deterministic or Non-Deterministic Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sat, 17 May 2008 09:39:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-38293</guid>
		<description><![CDATA[[...] SQL SERVER - 2005 - Use of Non-deterministic Function in UDF - Find Day Difference Between Any Date ...  You can run following code to determine if function is deterministic or not. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER &#8211; 2005 &#8211; Use of Non-deterministic Function in UDF &#8211; Find Day Difference Between Any Date &#8230;  You can run following code to determine if function is deterministic or not. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-34251</link>
		<dc:creator><![CDATA[Chris]]></dc:creator>
		<pubDate>Tue, 11 Mar 2008 14:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-34251</guid>
		<description><![CDATA[So in other words, we&#039;re not able to do things we should logically be able to do because of poor design in SQL Server&#039;s internals? Yes, heaven forbid a UDF use Rand(), and make subsequent calls to Rand() non-deterministic...

Someone as M$ is taking the whole &quot;no side-effects&quot; thing a bit too literally. At least this is a step in the right direction.]]></description>
		<content:encoded><![CDATA[<p>So in other words, we&#8217;re not able to do things we should logically be able to do because of poor design in SQL Server&#8217;s internals? Yes, heaven forbid a UDF use Rand(), and make subsequent calls to Rand() non-deterministic&#8230;</p>
<p>Someone as M$ is taking the whole &#8220;no side-effects&#8221; thing a bit too literally. At least this is a step in the right direction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-9107</link>
		<dc:creator><![CDATA[Simon]]></dc:creator>
		<pubDate>Thu, 23 Aug 2007 19:06:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/23/sql-server-2005-use-of-non-deterministic-function-in-udf-find-day-difference-between-any-date-and-today/#comment-9107</guid>
		<description><![CDATA[SQL Server 2005 has allowed some of the non-deterministic functions that were not allowed in 2000.  In 2005 you can now use 
CURRENT_TIMESTAMP
@@MAX_CONNECTIONS
GET_TRANSMISSION_STATUS
@@PACK_RECEIVED
GETDATE
@@PACK_SENT
GETUTCDATE
@@PACKET_ERRORS
@@CONNECTIONS
@@TIMETICKS
@@CPU_BUSY
@@TOTAL_ERRORS
@@DBTS
@@TOTAL_READ
@@IDLE
@@TOTAL_WRITE and
@@IO_BUSY

You still cannot use
NEWID
RAND
NEWSEQUENTIALID and
TEXTPTR

I got that detail from SQL Server Magazine, and may have changed since publication, but the end result is - it is not a bug, you can use GETDATE() in functions, 

Here is more directly from the article

&quot;SQL Server 2005 Books Online (BOL) doesn&#039;t provide a reason for this change or the distinction between the functions that are and aren&#039;t allowed, but you&#039;ll notice that the functions you can&#039;t use have side effects. That is, the SQL Server 2005 non-deterministic functions that aren&#039;t allowed make internal changes in the database or the system and leave a mark (such as a change to an interval value) that they have been invoked. And UDFs aren&#039;t allowed to have side effects. For example, when SQL Server invokes the RAND function it changes an internal value that&#039;s used to calculate the seed for the next invocation of the function. This means that had SQL Server allowed you to invoke RAND within a UDF, the invocation of the UDF would have changed the result of subsequent invocations of RAND outside the UDF as well. For this reason, you can&#039;t use RAND in a UDF, even in SQL Server 2005.&quot;]]></description>
		<content:encoded><![CDATA[<p>SQL Server 2005 has allowed some of the non-deterministic functions that were not allowed in 2000.  In 2005 you can now use<br />
CURRENT_TIMESTAMP<br />
@@MAX_CONNECTIONS<br />
GET_TRANSMISSION_STATUS<br />
@@PACK_RECEIVED<br />
GETDATE<br />
@@PACK_SENT<br />
GETUTCDATE<br />
@@PACKET_ERRORS<br />
@@CONNECTIONS<br />
@@TIMETICKS<br />
@@CPU_BUSY<br />
@@TOTAL_ERRORS<br />
@@DBTS<br />
@@TOTAL_READ<br />
@@IDLE<br />
@@TOTAL_WRITE and<br />
@@IO_BUSY</p>
<p>You still cannot use<br />
NEWID<br />
RAND<br />
NEWSEQUENTIALID and<br />
TEXTPTR</p>
<p>I got that detail from SQL Server Magazine, and may have changed since publication, but the end result is &#8211; it is not a bug, you can use GETDATE() in functions, </p>
<p>Here is more directly from the article</p>
<p>&#8220;SQL Server 2005 Books Online (BOL) doesn&#8217;t provide a reason for this change or the distinction between the functions that are and aren&#8217;t allowed, but you&#8217;ll notice that the functions you can&#8217;t use have side effects. That is, the SQL Server 2005 non-deterministic functions that aren&#8217;t allowed make internal changes in the database or the system and leave a mark (such as a change to an interval value) that they have been invoked. And UDFs aren&#8217;t allowed to have side effects. For example, when SQL Server invokes the RAND function it changes an internal value that&#8217;s used to calculate the seed for the next invocation of the function. This means that had SQL Server allowed you to invoke RAND within a UDF, the invocation of the UDF would have changed the result of subsequent invocations of RAND outside the UDF as well. For this reason, you can&#8217;t use RAND in a UDF, even in SQL Server 2005.&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

