Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Exec or Set for executing a function

Author  Topic 

Bex
Aged Yak Warrior

580 Posts

Posted - 2006-06-30 : 10:10:17
Does anyone know the advantages/disadvantages for using the following techniques to execute a function:

Set @param = (select fn_doesSomeThing (@param1))

Select @param = fn_doesSomeThing (@param1)

exec @param = fn_doesSomeThing @param1

I happended upon using exec accidently when I replaced a proc with a function. But I would really like to know if there are any differnces between the methods and if one method is more performant over the other and why.

Thankyou

Hearty head pats

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-30 : 10:27:53
Try looking at the query plans.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2006-06-30 : 11:27:09
I did think of that, but I was under the impression that the optimiser kinda ignores functions when generating execution plans??

Hearty head pats
Go to Top of Page
   

- Advertisement -