sql server programming:
You call an SP using exec
exec mysp2
To return data use output parameters
create proc mysp1
as
declare @p1 int, @p2 int, @p3 int
exec mysp2 @p1, @p2 out, @p3 out
select @p2, @p3
go
create proc mysp2
@p1 int, @p2 int out, @p3 int out
as
set @p2 =
set @p3 =
go
To return a resultset usea temp table of the correct structure and
insert #temp
exec mysp2
Have a look in bol.
[quoted text, click to view] "Alberto" wrote:
> I need call a store procedure from another and store the return value in a
> var.
> How can I do it?
>
> Thank you very much
>
>
Try:
create proc MyProc1
as
declare @rc int
exec @rc = exec MyProc2
go
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com ..
[quoted text, click to view] "Alberto" <alberto@nospam.es> wrote in message
news:e4QU48PxEHA.1192@tk2msftngp13.phx.gbl...
I need call a store procedure from another and store the return value in a
var.
How can I do it?
Thank you very much