MSSQL @ @ERROR using _mssql

Source: Internet
Author: User
Tags microsoft sql server mssql
Mssql
Error log file storage location: C:\Program Files\Microsoft SQL Server\mssql\log View with Notepad
@ @ERROR Returns an integer 0 as normal
sysmessages stored Error Information system table (master)
Use master
SELECT * FROM sysmessages where error= error number to query the cause of the error
RAISERROR (50009, 16, 10) can be used in triggers to throw errors, where 50009 is an error number, or an error message description 16 10 specific rows and columns can be set themselves
You can also define a custom message
Adds a custom message to the sysmessages.
Use master
EXEC sp_addmessage 50001, 16,
N ' percentage expects a value between and 100.
Please reexecute with a more appropriate value. ', ' us_english ', false,replace
EXEC sp_addmessage 50001, 16, ' Employee code not found ', ' Simplified Chinese ', false,replace
50001 16 must be consistent first add us_english version, and then add ' Simplified Chinese '
Replace means that if there is a 50001 number of information, it will be replaced by the new information

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.