How To Catch Errors While Inserting Values in Table [SQL Server]

If you often get errors when in inserting values in the table, use the TRY..CATCH. If you are using SQL Server 2005 or greater, you can take advantage of this set of tools for handling errors. By taking advantage of this features, you can focus more on IT business strategy development and less on the errors.

Here’s an example taken from

First create a simple table, then insert values in this table which we will throw errors and the same errors will catch on the table.

Using the TRY.. CATCH the error will be displayed in the SELECT statement.

Read the rest of the tutorial here:

Leave a Reply

Your email address will not be published. Required fields are marked *