Using SQL SERVER 2K
the following is the meat-n-potatoes of an sp. It generates an error because there are related child tables that the DELETE would leave orphaned, but my output parameter is never filled with any message and the RETURN value is 0.
What am I not understanding here?
the following is the meat-n-potatoes of an sp. It generates an error because there are related child tables that the DELETE would leave orphaned, but my output parameter is never filled with any message and the RETURN value is 0.
What am I not understanding here?
Code:
DELETE FROM dbo.tbl2
SET IDENTITY_INSERT dbo.tbl2 ON
INSERT INTO dbo.Biller
(field1,field2)
SELECT
c.field1, c.field2
FROM dbo.tbl1 c
SET IDENTITY_INSERT dbo.Biller OFF
--if any errors, return description in @ErrorMsg
IF @@ERROR > 0
BEGIN
SELECT @ErrorMsg = [DESCRIPTION]
FROM master.dbo.sysmessages
WHERE error = @@ERROR
END
--exit
RETURN @@ERROR