5
Answers

Sql function to get the max value from @temp table

sathish

sathish

6y
1.9k
1
Hi,
 
  Need to build one function by pass parameters and create one temp temp inside that to store fetched values and finally return the max of column values from that temp table as output
 
EX:
 
   fn_test (@P1,@P2)
   declare @temp (val 1, val 2)
   insert into @temp (1,2)
   insert into @temp (3,4)  
   select max(val1) from @temp -- as output and return 
 
Thanks
Sathish 
Answers (5)