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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 storing store procedure value in anther variable

Author  Topic 

scottichrosaviakosmos
Yak Posting Veteran

66 Posts

Posted - 2010-07-30 : 01:12:32
i have a SP for counterID generation and i want to use this SP in another SP and this is want to achive by storing the SP generated value in another variable.
i m doing : declare @a varchar
set @a=exec SPcounter

but this is giving error.

scoo

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-30 : 01:45:26
Is SPcounter using an OUTPUT parameter, a RETURN, or sending back a result set?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

scottichrosaviakosmos
Yak Posting Veteran

66 Posts

Posted - 2010-07-30 : 02:28:41
no i m not using output, can u tell me how to use and how to use this SP after that.





quote:
Originally posted by tkizer

Is SPcounter using an OUTPUT parameter, a RETURN, or sending back a result set?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



scoo
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-07-30 : 02:41:42
Return:-

exec @a=SPcounter
Select @a

Result Set:-

Insert into #temp (col1 int)
exec SPcounter

Select * from #temp

Output variable:-

EXEC SPcounter @a OUTPUT
Select @a

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -