I am trying to execute a THROW statement like so (value
and 12345
being some random values):
use testdb;
go
begin try
if('value' in (select distinct shelf from itemloc))
update itemloc
set shelf = 'value'
where item = '12345';
end try
begin catch
;Throw 160073, 'Failed to update shelf value', 1;
end catch;
Using this reference
I looked at this question and I have the ;
before my THROW
. I'm also checking the syntax against the reference and fail to see why executing this returns
Msg 102, Level 15, State 1, Line 11 Incorrect syntax near 'Throw'.