Incorrect syntax near 'THROW'

From MSDN:

The statement before the THROW statement must be followed by the semicolon (;) statement terminator.


I just hit the same error but for a completely different reason. The machine I'm using is slightly old but has SSMS 2012 (the version that THROW was introduced). However the actual SQL server is 10.5 (which is 2008 R2; see https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level) and so the command is not valid.

Hopefully there won't be too many instances of ten year old setups out there but double check if you get this and you're sure your syntax is correct!