SQL Server > Error Handling

Catch and Throw error in SQL Server

How to catch and throw error in SQL Server?


To throw error, we use THROW statement.

BEGIN TRY
       SELECT 'ITFunda'/0
END TRY
BEGIN CATCH
       THROW
END CATCH

Here, notice the BEGIN CATCH block that uses THROW statement to throw the error.

 Views: 9054 | Post Order: 98



Write for us






Hosting Recommendations