RAISERROR (13043, — Message id.
0, — Severity,
0, — State,
N’audit’) WITH LOG;
Here 13043 will send the string and will not identify anything written as the last parameter. In the above example the last parameter is N’audit’. Also WITH LOG confirms that the error is logged in the Applicatin Log and error log both.
INTERVIEW PREPARATION IN 30 MINs – Read Following wires for a quick interview preparation.
- SQL Server DBA “Interview Questions And Answers”
- SQL Azure Interview Questions and Answers Part – 1
- SQL Azure Interview Questions and Answers Part – 2
- Powershell Interview Questions and Answers
The good thing about this is that you also get the spid in the error log from where the error is thrown. The RAISERROR can be used in try catch to throw specific errors. The new errors can be added in the sys.sysmessages using sp_addmessage. Write me if you want to learn about this.
Online MSSQL Classes @ http://tuitionaffordable.webstarts.com