Friday, April 29, 2011

What's wrong with this MySQL statement: DECLARE @ID INT

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?

From stackoverflow
  • DECLARE is used in stored procedures/functions.

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

  • try naming the variable without the @

    DECLARE id INT;
    

0 comments:

Post a Comment