I have the following code in the Query Analyzer that should generate the error:
INSERT INTO test(field1, field2, field3) values ('PP','PP',0,'hh')
IF @@error <> 0
Print 'Failed'
ELSE
Print 'OK'
GO
Why does the @@error global variable is not being set to the error number?? The print statement is never executed.
Server: Msg 110, Level 15, State 2, Line 6
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
TIA,
Daniel