Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
@@Error
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
@@Error
Miscellaneous
Thread ID:
01113074
Message ID:
01113074
Views:
54
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
Next
Reply
Map
View

Click here to load this message in the networking platform