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)
 SP Coding Optimization

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-11-07 : 08:36:58
I have a SP that needs to retrieve a scalar value, and the code to retrieve that scalar is complex enough to be written in yet another outside procedure.

Is there any compile or execution time merit in using a UDF (which doesn't require use of an EXEC) or just creating another SP (which requires an EXEC and an OutputVariable?

In other words, is

SELECT @Gotit = dbo.MyUDF(@MyParm)

any better than

EXEC dbo.MySP @Parm1=@MyParm, @Out1=@MyOut

(I thought I had read somewhere that EXEC didn't compile or optimize well.)

Sam

   

- Advertisement -