I did read the article, yes. I am aware of the potential for performance
hits. Thank you for your reply.
"Uri Dimant" wrote:
> Matt
> I hope you read the article I have posted here
>
> SELECT myUDF(ColumnA), ColumnB
> FROM tableQ
> WHERE ColumnB = 'SomeValue'
>
> In that case an UDF will be executed for each rows in the table that
> matching to the WHERE condition
>
>
>
>
> "Matt" <Matt@discussions.microsoft.com> wrote in message
> news:7A6BC4E0-2770-4788-8ED7-6EA712C4393B@microsoft.com...
> >A UDF that converts the stored UTC datetime to the localtime of a specific
> > time zone. It returns a single nvarchar.
> >
> > "Uri Dimant" wrote:
> >
> >> Matt
> >> What kind of UDF do you have ?
> >>
http://www.sql-server-performance.com/user_defined_functions.asp > >>
> >>
> >>
> >>
> >>
> >> "Matt" <Matt@discussions.microsoft.com> wrote in message
> >> news:C2A75BF7-8D42-4EEF-98E4-73083A23EB74@microsoft.com...
> >> > Given a statement such as this:
> >> >
> >> > SELECT myUDF(ColumnA), ColumnB
> >> > FROM tableQ
> >> > WHERE ColumnB = 'SomeValue'
> >> >
> >> > Does the myUDF function still get executed against every record in the
> >> > table, even though the WHERE clause contains enough information to
> >> > allow
> >> > the
> >> > myUDF function to execute against only the filtered subset of records
> >> > that
> >> > would be returned?
> >> >
> >> > I could understand that a slightly modified version of it...
> >> >
> >> > SELECT ColumnA, ColumnB
> >> > FROM tableQ
> >> > WHERE myUDF(ColumnB) = 'SomeTransformedValue'
> >> >
> >> > ...would actually require that the function is executed against every
> >> > record
> >> > to evaluate the condition. But what would the behavior be on the
> >> > former
> >> > example?
> >> >
> >> > To beat the dead horse, I would expect SQL to be smart enough to only
> >> > execute that function once if given the following syntax:
> >> >
> >> > SELECT TOP 1 myUDF(ColumnA)
> >> > FROM tableQ
> >> >
> >> >
> >> > The answer will help me determine whether I want to take a user defined
> >> > function approach to manipulating some values or if I'll push this
> >> > manupulation back to my business layer...
> >> >
> >> > Thanks in advance!
> >> > Matt
> >>
> >>
> >>
>
>