MSSQL Create custom exception

Source: Internet
Author: User
Tags mssql


When you create it, you must first create it in English, or you will get an error:
You must add the us_english version of this message before you can add the ' Simplified Chinese ' version.

EXEC sp_addmessage 50001, ' option wrong ', ' us_english '
EXEC sp_addmessage 50001, 15, ' Operation error ', ' Simplified Chinese '

Exception thrown in code addition:
RAISERROR (50001,16,1)

Execution Result:
Msg 50001, Level 16, State 1, line 2nd
Operation Error


To modify the exception information content:
EXEC sp_addmessage 50001, 15, ' Operation S error ', ' Simplified Chinese ', false, ' REPLACE '


Finally, you can delete:
EXEC sp_dropmessage 50001, ' option wrong ', ' us_english '
EXEC sp_dropmessage 50001, 15, ' Operation error ', ' Simplified Chinese '

The complete command format is described in:
Ms-help://ms. Sqlcc.v10/ms. Sqlsvr.v10.zh-chs/s10de_6tsql/html/54746d30-f944-40e5-a707-f2d9be0fb9eb.htm created, you must first create English, otherwise you will get an error:
You must add the us_english version of this message before you can add the ' Simplified Chinese ' version.

EXEC sp_addmessage 50001, ' option wrong ', ' us_english '
EXEC sp_addmessage 50001, 15, ' Operation error ', ' Simplified Chinese '

Exception thrown in code addition:
RAISERROR (50001,16,1)

Execution Result:
Msg 50001, Level 16, State 1, line 2nd
Operation Error


To modify the exception information content:
EXEC sp_addmessage 50001, 15, ' Operation S error ', ' Simplified Chinese ', false, ' REPLACE '


Finally, you can delete:
EXEC sp_dropmessage 50001, ' option wrong ', ' us_english '
EXEC sp_dropmessage 50001, 15, ' Operation error ', ' Simplified Chinese '

The complete command format is described in:
Ms-help://ms. Sqlcc.v10/ms. Sqlsvr.v10.zh-chs/s10de_6tsql/html/54746d30-f944-40e5-a707-f2d9be0fb9eb.htm

MSSQL Create custom exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.