home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,049 of 19,505   
   Erland Sommarskog to migurus   
   Re: help with output parameters needed   
   13 Mar 14 08:40:25   
   
   From: esquel@sommarskog.se   
      
   migurus (migurus@yahoo.com) writes:   
   > My difficulty is that SP can return output parameters, but it seems I   
   > can't call SP in select? The UDF can be called from select but can not   
   > return more than one value and I need to return at least two, in fact 4   
   > values, I just simplified everything.   
      
   You can make it a table-valued function that returns a one row result   
   set, and then use cross apply:   
      
   SELECT ..   
   FROM   tbl   
   CROSS APPLY dbo.run(col1, col2) AS run   
      
   However, as Ross says, it is better if you can implement something that   
   operates on a set of data, taking the input from a table-valued parameter.   
   For large data sets, this could be a dramatic difference in performance.   
      
   --   
   Erland Sommarskog, Stockholm, esquel@sommarskog.se   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca