Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select variable value return from a procedure

Author  Topic 

itskhan
Starting Member

8 Posts

Posted - 2011-04-06 : 04:50:09
Hi I have a procedure whis is returing fine
I want to select one value into a variable from it after executing it but did'nt work.
I am doing this:

USE Excel
GO

DECLARE @tcount bigint

EXEC [dbo].[mSP_GETPATHOLOGISTWORKLIST]
@SECTION = 1,
@StartRowIndex = 1,
@MaximumRows = 10,
@COUNTREQUIRED = 'Y',
@TotalCount = @tcount OUTPUT

SELECT @tcount as N'@TotalCount'

Regards,
Raza

McDebil
Starting Member

23 Posts

Posted - 2011-04-06 : 05:04:42
DECLARE @TotalCount bigint

EXEC [dbo].[mSP_GETPATHOLOGISTWORKLIST]
@SECTION = 1,
@StartRowIndex = 1,
@MaximumRows = 10,
@COUNTREQUIRED = 'Y',
@TotalCount OUTPUT

SELECT @TotalCount as N'@TotalCount'


McDebil
Go to Top of Page

itskhan
Starting Member

8 Posts

Posted - 2011-04-06 : 05:58:38
The soloution Provided is not working
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-06 : 06:05:55
did you defined the @TotalCount as OUTPUT parameter in your stored procedure ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

itskhan
Starting Member

8 Posts

Posted - 2011-04-06 : 06:08:57
Yes
@TotalCount BIGINT OUTPUT
is defined in the procedure
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-06 : 06:11:31
so what is not working ?

or maybe you have a bug inside your stored procedure ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

McDebil
Starting Member

23 Posts

Posted - 2011-04-06 : 06:12:52
Script the procedure for execute in the SSMS and run it.
You can SELECT the declared output parameter after the execute command.

McDebil
Go to Top of Page
   

- Advertisement -