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 2000 Forums
 Transact-SQL (2000)
 how to call stored procedure from select Statement?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-20 : 09:14:49
Shantanu writes "I have a stored procedure and I like to call this from select statement.
This stored procedure returns Description about the code passed to procedure RejectDesc recordset by select command inside.
How to call a stored procedure like below:

declare @RejDesc varchar(20)
select ID, (exec RejectDesc CODE,@Desc=@RejDesc output) as name
from Trans

Trans Table have two fields

1)ID
2)CODE

thank in advance"

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-05-20 : 09:29:15
You cant use stored procedures in this way. For something as straightforward as getting a description change your stored proc to a user-defined function instead and call the function in the select statement.


Raymond
Go to Top of Page
   

- Advertisement -