Robinstwitcher
Programmer
I have a multiple store procs that are called from a 'controlling' store proc. This is working fine, however I am trying to introduce Error trapping. This is all fairly new to me and I need some advice as to what I should be looking for.
So far I have been using:
CREATE PROCEDURE Control AS
DECLARE @retStatus int
exec @retstatus = [Upload]
if @retstatus !=0 begin
GOTO ErrorMsg
exec @restatus = [Update]
ErrorMsg:
PRINT 'Return Status is '+cast(@retsatus as nchar(10))
GO
and
CREATE PROCEDURE Upload AS
INSERT INTO Tbl2
(col1,col2)
SELECT Col1, Col2
FROM Tbl1
RETURN @@Error
GO
This works Ok for a truncation error (returns status 8152) , however a Disallowed implicit conversation............... returns a status of 0 (i.e. no error)
Am I doing something drastically wrong!
So far I have been using:
CREATE PROCEDURE Control AS
DECLARE @retStatus int
exec @retstatus = [Upload]
if @retstatus !=0 begin
GOTO ErrorMsg
exec @restatus = [Update]
ErrorMsg:
PRINT 'Return Status is '+cast(@retsatus as nchar(10))
GO
and
CREATE PROCEDURE Upload AS
INSERT INTO Tbl2
(col1,col2)
SELECT Col1, Col2
FROM Tbl1
RETURN @@Error
GO
This works Ok for a truncation error (returns status 8152) , however a Disallowed implicit conversation............... returns a status of 0 (i.e. no error)
Am I doing something drastically wrong!