Hi Friends,

Continuing with my DENALI series, today I would like to talk about the new THROW statement. T-SQL TRY/CATCH were available since SQL Server 2005 but THROW and FINALLY were missing. We have THROW now, but FINALLY is yet to come :)

The syntax as follows:

A simple example could be as follows:

1_SQL_Server_2012_DENALI_series_THROW_statement

Another example of THROW, this time inside CATCH block:

Output:

2_SQL_Server_2012_DENALI_series_THROW_statement

There are some notable differences between RIASERROR & THROW which I shall cover in another blog. I have also heard some people talking about deprecation of RAISERROR but I am not sure on this. (However, I don’t think that should be happening)