Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Stored Procedure

Status
Not open for further replies.

destinyml

ISP
Apr 27, 2004
27
DK
Hi

I have a stored procedure [CreateHandle] which will return a one record with a single cell. E.g.:

[Handle]
GDR5H


Now I am trying to call the stored procedure from within another procedure and grab the return value into a variable. So something like this (not the correct syntax):

DECLARE @Handle char(5)
SET @Handle = EXEC [dbo].[CreateHandle]

What is the correct syntax?

Thanks
 
Procedure 1
Code:
ALTER  PROCEDURE dbo.usp_test1
  @Handle varchar(5) OUTPUT
as

set @Handle = (your select statement )

Procedure 2:
Code:
alter PROCEDURE dbo.usp_test2 AS
declare @retchar varchar(5)
exec dbo.usp_test1 @retchar output
select @retint

Jim
 
Thank you for yuor reply.... I figured out that a user-defined function was a better choise though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top