views:

1312

answers:

2
DECLARE @ID INT ;

This statement parses fine with MS SQL Server, but gives me

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE @ID INT' at line 1

Does anyone have any idea about the reason?

+5  A: 

DECLARE is used in stored procedures/functions.

If you're looking to set a variable for just regular queries, use SET

Darryl E. Clarke
+2  A: 

try naming the variable without the @

DECLARE id INT;
Jose Basilio