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


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

Re: help with output parameters needed

Path csiph.com!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: help with output parameters needed
Date Thu, 13 Mar 2014 08:40:25 +0100
Organization Erland Sommarskog
Lines 19
Message-ID <XnsA2EF583BEC611Yazorman@127.0.0.1> (permalink)
References <88badd6b-44dc-44ed-81c0-a423f3053ab6@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Info mx05.eternal-september.org; posting-host="fd3d6d0229f14a752f017d8f9903addd"; logging-data="13950"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19A3tER4dGvs+CxH6Oq2rex"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:ltuuBOQvJFvTRssE81eKKAd4fUk=
Xref csiph.com comp.databases.ms-sqlserver:1729

Show key headers only | 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