Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1729

Re: help with output parameters needed

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: help with output parameters needed
Date 2014-03-13 08:40 +0100
Organization Erland Sommarskog
Message-ID <XnsA2EF583BEC611Yazorman@127.0.0.1> (permalink)
References <88badd6b-44dc-44ed-81c0-a423f3053ab6@googlegroups.com>

Show all headers | View raw


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

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

help with output parameters needed migurus <migurus@yahoo.com> - 2014-03-12 20:41 -0700
  Re: help with output parameters needed Ross Presser <rpresser@gmail.com> - 2014-03-12 21:01 -0700
  Re: help with output parameters needed Erland Sommarskog <esquel@sommarskog.se> - 2014-03-13 08:40 +0100

csiph-web