Tuesday, June 4, 2019

How to use a value from one stored procedure in another?

pass @Count as an output parameter.

Create Proc dbo.usp_GetCount

@Id int,
@Count int output

as begin

select @Count = Count(Item) from tblItem where id=@Id

end
Go

Declare @Count int
Declare @Id int

Set @Id = 1

Exec dbo.usp_GetCount @Id, @Count output

select @Count

No comments:

Post a Comment