Xpode.com        Click here to Print this article.

SQL Server interview question notes: - Raise error

Point 1:- RAISERROR is used to raise error / warning back to the application or a catch block.

Point 2:- Syntax of RAISERROR is as below

RAISERROR (@Messageid -- Error message number stored in Sys.messages table
           @ErrorSeverity, -- Severity ( 0-25)
           @ErrorState -- State
	   @ErrorMessage, -- Error message string
	   );

Point 3:- You can raise system error message or user defined error message. For user defined error messages it should be greater than 50000.

Point 4:- If you do not specify the error number the error message id is considered 50000 (user defined error message)

Point 5:- Error severity defines how serious the error is. Severity levels from 0 through 18 can be specified by any user. Severity levels from 19 through 25 can only be specified by members of the sysadmin.

Point 6:- If error is raised from multiple location you can use this number to define from which location the error is raised.

You can buy our SQL Server interview questions book from flipkart by clicking here

Watch this awesome video of SQL Server interview question:- What are Sub Query and Co-related Queries?

See our 500 video of .NET and SQL server interview question

Regards,

Click to view more from author's on SQL Server Interview question



http://
http://

Contributed by:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=633

Click here to go on website