sathish

sathish

  • NA
  • 263
  • 0

Sql function to get the max value from @temp table

Feb 26 2019 8:26 AM
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)