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)
 Catch a returnd string

Author  Topic 

lalle
Starting Member

3 Posts

Posted - 2003-10-27 : 08:32:49
Hi!

I call a sp from another sp, the child-sp returns a char(12), how to catch the string in the parent (calling sp)?

Cheers,
lalle

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2003-10-27 : 09:23:14
Use a char(12) OUTPUT parameter in the parent SP's call to the child SP


Raymond
Go to Top of Page

MakeYourDaddyProud

184 Posts

Posted - 2003-10-27 : 09:26:39
Also, remember that you cannot "return" anything other than an int datatype from a procedure, that is, using the return @variable format.

Daniel Small MIAP
www.danielsmall.com IT Factoring
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-10-27 : 12:05:50
quote:
Originally posted by danny2sweet

Also, remember that you cannot "return" anything other than an int datatype from a procedure, that is, using the return @variable format.



I guess that could be a bit misleading...Daniel is refering to The RETURN keyword...


CREATE PROC mySproc
@x varchar(26) OUTPUT
AS
DECLARE @RC int
SELECT @x = CONVERT(varchar(26),GetDate())
SELECT @RC = @@ERROR
IF @RC <> 0
SELECT @RC = -1
RETURN @RC
GO

DECLARE @x varchar(26), @RC int
EXEC @RC=mySPROC @x OUTPUT
SELECT @x, @RC
GO

DROP PROC mySPROC
GO


Don't forget your error handling...



Brett

8-)
Go to Top of Page
   

- Advertisement -