﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Dinesh Priyankara / Article Discussions / Article Discussions by Author  / UDF as Computed Column Part 2 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 13:17:02 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>&lt;P&gt;Sorry, Dinesh, you've got so many titles... Just like number of operands in your script.&lt;/P&gt;&lt;P&gt;But what about performance of your scripts? It's good while it has only 4 rows to work out.&lt;/P&gt;&lt;P&gt;What if you replace your function with this one?&lt;/P&gt;&lt;P&gt;CREATE FUNCTION dbo.fn_getDuration (@STime datetime, @ETime datetime)RETURNS datetimeASBEGIN DECLARE @Duration Datetime&lt;/P&gt;&lt;P&gt; SET @Duration = @ETime-@STime RETURN @Duration - floor(convert(real, @Duration))&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;First, it's more precise: it counts not only hours and minutes, but seconds and milliseconds as well. So, it's more usefull;Second, it works times faster;And third, it returns datetime value, so you can use it in criteria check for select from big table: WHERE dbo.fn_getDuration (..) &amp;gt; '05:00:00'&lt;/P&gt;&lt;P&gt;Best regards,Sergiy.&lt;/P&gt;</description><pubDate>Wed, 14 Jul 2004 16:28:00 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>Hmmmm... It was with the first script "Create Schema Authorization" but the entire exercise worked fine this morning.  The fn_getDuration function is nice little headbanger.  Thanks for your assistance. </description><pubDate>Wed, 23 Jul 2003 03:16:00 GMT</pubDate><dc:creator>currym</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>&lt;font face='Verdana'&gt;Hi Currym,I have tested the script and had not found any error. Let me know the exact code you ran.Dinesh&lt;/font id='Verdana'&gt;MCP MCSE MCSD MCDBA</description><pubDate>Tue, 22 Jul 2003 04:38:00 GMT</pubDate><dc:creator>Dinesh Priyankara</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>Thanks for your work.  I must have screwed something up but when I ran the 'Create Schema' script I received the following error:Server: Msg 156, Level 15, State 1, Line 4Incorrect syntax near the keyword 'NULL'. </description><pubDate>Tue, 22 Jul 2003 01:52:00 GMT</pubDate><dc:creator>currym</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>&lt;font face='Verdana'&gt;Hi noggin,BOL stand for Books OnlineDinesh&lt;/font id='Verdana'&gt;MCP MCSE MCSD MCDBA</description><pubDate>Tue, 15 Jul 2003 21:41:00 GMT</pubDate><dc:creator>Dinesh Priyankara</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>Pardon my ignorance but what is BOL? </description><pubDate>Tue, 15 Jul 2003 14:03:00 GMT</pubDate><dc:creator>noggin</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>I also was unaware of the CREATE SCHEMA AUTHORIZATION command thanks for taking a minute to explain it. It will truly come in handy in the future.Thanks for articles. I have been planning more UDFs since reading your first article and this second one confirms the path I was thinking down.Thanks,Ross </description><pubDate>Mon, 14 Jul 2003 08:29:00 GMT</pubDate><dc:creator>bozo7</dc:creator></item><item><title>RE: UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>Dinesh(As a side effect to the article), thanks for making me aware of the CREATE SCHEMA AUTHORIZATION command.raj </description><pubDate>Mon, 14 Jul 2003 02:30:00 GMT</pubDate><dc:creator>rajenshah</dc:creator></item><item><title>UDF as Computed Column Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic13692-108-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/dPriyankara/udfascomputedcolumnpart2.asp&gt;http://www.sqlservercentral.com/columnists/dPriyankara/udfascomputedcolumnpart2.asp&lt;/A&gt;</description><pubDate>Sat, 28 Jun 2003 00:00:00 GMT</pubDate><dc:creator>Dinesh Priyankara</dc:creator></item></channel></rss>