Stored Procedures: Error Handling

Last Post 11 Mar 2009 11:11 AM by GoodFella3993. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
GoodFella3993
New Member
New Member

--
11 Mar 2009 11:11 AM
I have a stored procedure (SP_A). This procedure calls another stored procedure (SP_B).

If SP_B runs successfully, I want it to set a variable (@Status) in SP_A to "SUCCESS".

IF SP_B does NOT run successfully, I want it to set a variable (@Status) SP_A to "FAIL".

SP_A:

quote:


CREATE PROCEDURE SP_A @CampaignCode VARCHAR, @SourceCode VARCHAR

AS

DECLAR @Status as varchar(100)

EXEC dbo.sp_create_campaign @CampaignCode, @SourceCode

SET @Status = "SUCCESS"



SP_B:

quote:


CREATE PROCEDURE SP_B @CampaignCode VARCHAR, @SourceCode VARCHAR

AS

INSERT INTO campaign_dim (CampaignCode, SourceCode)
Values (@CampaignCode, @SourceCode)




Thanks,
Marc
You are not authorized to post a reply.

Acceptable Use Policy