I am facing the famous \'Incorrect syntax\' while using a THROW
statement in a T-SQL stored procedure. I have Googled it and checked the questions on StackOverf
As pointed out through many answers, the THROW statement was introduced in SQL Server 2012. So if you are using this version of SQL Server or later, it is recommended to use THROW, else use RAISERROR.
Also, the statement before the THROW statement must be followed by the semicolon (;) statement terminator. That's why you must include a semicolon before the throw.
Look at this article about the Differences Between RAISERROR and THROW in Sql Server
I would also like to encourage you to read the documentation from MSDN THROW (Transact-SQL) which explains these matters at the Remarks section.