Replace UDF in the procedure

Last Post 20 May 2009 07:03 AM by MattiasLind. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
sql-tips
New Member
New Member

--
05 Mar 2009 06:28 AM
I have stored procedure using UDF in the select. I want to replace the UDF.

Here is simple form of my procedure, but udf is much complicated with loops and cursors.

create procedure test
@a int, @b char(10)
begin

select col1,col2,col1 * udf_a(@,@b)
from table.

End
MattiasLind
New Member
New Member

--
20 May 2009 07:03 AM
1) EXECUTE sp_helptext 'udf_a'
2) examine the code of the function
3) change the col1*udf_a(@,@b) to the calculation from the function that you can read in step 2

As simple as that!


Acceptable Use Policy
---