Number of questions 1,751
Number of tests completed 253,259
Number of questions answered 3,776,999
Number of registered users 19,213
Sign In | Register
Skip Navigation Links
Question: How can you raise custom errors from stored procedure?
Answer1: Exception Block
Answer2: Try
Answer3: Catch
Answer4: RAISERROR statement
Answer: RAISERROR statement

Explaination: The RAISERROR statement is used to produce an ad hoc error message or to retrieve a custom message that is stored in the sysmessages table. You can use this statement with the error handling code presented in the previous section to implement custom error messages in your applications.RAISERROR ({msg_id |msg_str }{,severity ,state } [ ,argument [ ,,...n ] ] )) [ WITH option [ ,,...n ] ] A description of the components of the statement follows. msg_id:-The ID for an error message, which is stored in the error column in sysmessages. msg_str:- A custom message that is not contained in sysmessages. Severity: - The severity level associated with the error. The valid values are 0–25. Severity levels 0–18 can be used by any user, but 19–25 are only available to members of the fixed-server role sysadmin. When levels 19–25 are used, the WITH LOG option is required.
Link: External Explaination

Correctly answered: 879
Incorrectly answered: 218
Terms of Use Ver. 2.0.6783.38332