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
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