Hi.
I have a Stored Procedure that has several "Insert" statements. After each
Insert I check @@ERROR and if not zero, use RAISERROR and RETURN.
I'm using VB 6.0 to call the Stored Procedure.
The problem is that if there is an error (e.g. converting to SmallMoney
when the field being converted is > 214,748.3648), I don't get the
RAISERROR error, I get the ADO error "Arithmetic overflow error converting
numeric to data type smallmoney".
I would prefer to get the error message associated with the RAISERROR
statement so is there any way to turn off error handling in the Stored
Procedure so that my RAISERROR code is executed?
Of course, if I could get both the ADO and RAISERROR error messages that
would be the best scenario.
Here's my VB code to call the Stored Procedure:
-----------------------------------------------
On Error Resume Next
aConn.Execute "Build03Test", lRecsAffected, adCmdStoredProc
If aConn.Errors.Count > 0 Then
For Each errLoop In aConn.Errors
sError = sError & errLoop.Description & vbCrLf
Next errLoop
End If
End If
Here's part of the Stored Procedure Build03Test:
------------------------------------------------
Insert Into MyFile2(A,B,C)
Select A, B, C from MyFile1
IF (@@error <> 0)
BEGIN
RAISERROR 50001 'MapPPO03PPOF: Cannot insert Facilities contracts'
ROLLBACK TRAN
RETURN(5)
END
If A in MyFile1 is > 214,748.3648 when Inserting into A (defined as
SmallMoney in MyFile2) then I never get to RAISERROR.
Any suggestions would be greatly appreciated.
Rita