Standardized RAISERROR Calls

Call RAISERROR using one of the predefined error messages.

Error Number: 990000
For Error @error <> 0 in a SELECT
Sample Call RAISERROR(990000, 16, 1, @error, @spName, 'CCFIRule', @msg) WITH SETERROR
Sample Output Error 1000 in CCSPSIS_GetSponsorID selecting from CCFIRule. (FIID: Corillian)
Comments Not normally used.  Some older code has this message after a select, but a SELECT should not cause @error to be non-zero unless there is an overall problem with the database.
Error Number: 990001
For Error @error <> 0 in an INSERT
Sample Call RAISERROR(990001, 16, 1, @error, @spName, 'CCBillPayRun', @msg) WITH SETERROR
Sample Output Error 1001 in CCSPSIS_CreateRun inserting into CCBillPayRun. (ProcessorID: 4) (RunID: 35)
Comments @error should be checked after every INSERT.
Error Number: 990002
For Error @error <> 0 in an UPDATE
Sample Call RAISERROR(990002, 16, 1, @error, @spName, 'CCUser', @msg) WITH SETERROR
Sample Output Error 1002 in CCSPSIS_UpdateSubscriberRcds updating CCUser. (FIID: Corillian)
Comments @error should be checked after every UPDATE.
Error Number: 990003
For Error @error <> 0 in a DELETE
Sample Call RAISERROR(990003, 16, 1, @error, @spName, '#tmpGetCurrBills', @msg) WITH SETERROR
Sample Output Error 1003 in CCSPEB__GetCurrentBills deleting from #tmpGetCurrBills. (FIID: Corillian) (UserID: 411400) (UserPayeeID: 25)
Comments @error should be checked after every DELETE.
Error Number: 990004
For Error @rowcount value unexpected in a SELECT
Sample Call RAISERROR(990004, 16, 1, @spName, 'CCFIRule', @rowcount, @msg) WITH SETERROR
Sample Output Error in CCSPSIS_GetBankAcctUserInfo: select from CCFIRule returned 0 rows. (FIID: Corillian)
Comments Not normally used.  Occasionally appropriate after a SELECT.  For instance, if the code before this select determines that a SELECT should return at least one row, then check for @rowcount < 1.
Error Number: 990005
For Error @rowcount value unexpected in an INSERT
Sample Call RAISERROR(990005, 16, 1, @spName, 'CCSisPaymentRecord', @rowcount, @msg) WITH SETERROR
Sample Output Error in CCSPSIS_GetBankAcctUserInfo: insert into CCSisPaymentRecord returned 0 rows. (FIID: Corillian)
Comments
@rowcount should be called after almost every INSERT.
If the INSERT should add exactly one row, check for @rowcount <> 1.
If the INSERT should add at least one row, check for @rowcount < 1.
In the rare case where an INSERT is based on a SELECT that may or may not cause an INSERT, do not check @rowcount.
Error Number: 990006
For Error @rowcount value unexpected in an UPDATE
Sample Call RAISERROR(990006, 16, 1, @spName, 'CCUser', @rowcount, @msg) WITH SETERROR
Sample Output Error in CCSPBP_SubscriberInfoReply: update CCUser returned 0 rows. (FIID: Corillian) (UserID: 411400) (ProcessorID: 4)
Comments See comments for error 990005.
Error Number: 990007
For Error @rowcount value unexpected in a DELETE
Sample Call RAISERROR(990007, 16, 1, @spName, 'CCAcctMerge', @numrows, @msg) WITH SETERROR
Sample Output Error in CCSP_AcctMerge: delete from CCBankAcct returned 0 rows. (FIID: Corillian) (UserID: 411400)
Comments See comments for error 990005.
Error Number: 990008
For Error @@error non-zero after a call to a stored procedure
Sample Call RAISERROR(990008, 16, 1, @returnValue, @spName, 'CCSPAU_FindRelationshipNameFromRelationshipID', @msg) WITH SETERROR
Sample Output Error 334 in CCSPAU_GetPrimaryUser after call to CCSPAU_FindRelationshipNameFromRelationshipID. (RelationshipID: 10032)
Comments Normally used in conjunction with 60014.
Error Number: 990014
For Error A stored procedure could not be executed or returned NULL
Sample Call RAISERROR(60014, 16, 1, @spName, 'CCSPAU_FindRelationshipNameFromRelationshipID', @msg) WITH SETERROR
Sample Output Error in CCSPAU_GetPrimaryUser: call to CCSPAU_FindRelationshipNameFromRelationshipID returned NULL or could not be executed. (RelationshipID: 10032)
Comments Normally used in conjunction with 990008.