SQL Server interview question notes: - Raise error

30 0 0
                                        

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 http://www.flipkart.com/sql-server-interview-questions-8183331033/p/itmdyuqz2a6tzhjw?pid=9788183331036&ref=2feb23bf-ef52-470e-b746-1157dc8bd8ab

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

SQL Server interview question notes: - Raise errorWhere stories live. Discover now