Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding functions.
Message
From
09/05/2007 11:53:02
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01223806
Message ID:
01223823
Views:
25
>The calls to UDFs are very expensive. If UDF is called for each record than it'll slow down query significantly. The first one guaranties that UDF will be called only 2 times. The second case depends on how smart SQL Query optimizer is.

That's what I expected, but was hoping for confirmation. If the UDF performs a query, it may be better to do the UDF's query as a derived table?

>
>>I've inherited a system with SQL stored procedures and functions. I want to clarify my understanding.
>>
>>Would this ...
>>
>>select @startdate = dbo.myfunction(@startdate)
>>select @enddate = dbo.myfunction(@enddate)
>>
>>SELECT * from table where datefield between @startdate and @enddate
>>
>>be better than this...
>>
>>SELECT * from table where datefield between dbo.myfunction(@startdate) and dbo.myfunction(@enddate)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform