Back to Browse

Day-24 | Error Handling in SQL Server | Sql Server Exception Handling | Try | Catch | Raiserror

285 views
Aug 24, 2023
27:46

Error Handling or exception handling in sql server Exception Handling in SQL Server An error condition during program execution is called an exception, and the mechanism for resolving such an exception is known as exception handling. We can put all T-SQL statements into a TRY BLOCK, and the code for exception handling can be put into a CATCH block. We can also generate user-defined errors using a THROW block. System Defined ERROR_MESSAGE() - you can take advantage of this function to get the complete error message. ERROR_LINE() - this function can be used to get the line number on which the error occurred. ERROR_NUMBER() - this function can be used to get the error number of the error. ERROR_SEVERITY() - this function can be used to get the severity level of the error. ERROR_STATE() - this function can be used to get the state number of the error. ERROR_PROCEDURE() - this function can be used to know the name of the stored procedure or trigger that has caused the error. SUSER_SNAME() function return login user id RAISERROR

Download

1 formats

Video Formats

360pmp438.9 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Day-24 | Error Handling in SQL Server | Sql Server Exception Handling | Try | Catch | Raiserror | NatokHD