Hello,
I have a stored procedure where I insert data into a table. At the end of this insert I want to make sure that there are no errors. Can you tell me how to do this?
Here is my code:
DECLARE @Return int
SET @Return = 0
INSERT INTO tblQrtCHC (HeaderRecord)
/*---------------------------------------*/
/* Create Contribution Header */
/*---------------------------------------*/
SELECT CONVERT(CHAR(100),
'00' + --2,2
'USFC '+ --12,14
SPACE(86) --86,100
) AS HeaderRecord
/*--------------------------------------*/
/* Append Employee Contribution Detail */
/*--------------------------------------*/
UNION ALL
SELECT DataRecord
FROM tblCHCEmployee
I do not know what to do with my local variable @Return to get an alert if something on the insert goes wrong.
Thank you in advance.
TomR100
I have a stored procedure where I insert data into a table. At the end of this insert I want to make sure that there are no errors. Can you tell me how to do this?
Here is my code:
DECLARE @Return int
SET @Return = 0
INSERT INTO tblQrtCHC (HeaderRecord)
/*---------------------------------------*/
/* Create Contribution Header */
/*---------------------------------------*/
SELECT CONVERT(CHAR(100),
'00' + --2,2
'USFC '+ --12,14
SPACE(86) --86,100
) AS HeaderRecord
/*--------------------------------------*/
/* Append Employee Contribution Detail */
/*--------------------------------------*/
UNION ALL
SELECT DataRecord
FROM tblCHCEmployee
I do not know what to do with my local variable @Return to get an alert if something on the insert goes wrong.
Thank you in advance.
TomR100