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
 General SQL Server Forums
 New to SQL Server Programming
 passing values in user defined functions

Author  Topic 

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2007-04-25 : 07:25:19
i want to pass a value from one user defined function to another how do i do it.E.g

My first function calulate a value which is to be used by another function for calculation
my 2nd function is given below

Create Function Avg_WLPD_CFS(@Res float,@TotDay int)
Returns float
As
Begin
Return(@Res/@TotDay)
end

the value @Res is calculated from first function, how do i pass this value to the above function.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-25 : 07:38:41
1. Store the output of first function in a variable and then pass that variable to second function.

2. Just call one function inside another like this:

Select dbo.func2(dbo.func1(), ...)


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -