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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Parameter from Transact SQL Stored Proc

Status
Not open for further replies.

DavidPike

Programmer
Oct 9, 2007
18
I am using the folowing CREATE, SET and RETURN statements but nothing is returning from my proc, any tips?

CREATE PROCEDURE dbo.sp_ReplicateChildSchedule
@P_Child nvarchar(50),
@P_WeekToCopy DateTime ,
@P_WeekBeginDate DateTime,
@P_Msg Varchar(50) OUTPUT
AS

SET @P_Msg = '0 schedules replicated'

RETURN
 
How are you calling this procedure? I just ran a quick test, and it does appear to be working for me.


Using your procedure above, I can run the following code and get the message output.

Code:
Declare @OutputMessage VarChar(50)

Declare     @P_Child nvarchar(50),
    @P_WeekToCopy DateTime ,
    @P_WeekBeginDate DateTime

Exec dbo.sp_ReplicateChildSchedule @P_Child, @P_WeekToCopy, @P_WeekBeginDate,@OutputMessage OUT

Select @OutputMessage

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
George Solved it for me. I was putting the OUTPUT qualifier on the variable in the CREATE statement but not in the EXEC statement. It works now, thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top