Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.

How to declare variable?

male110's profile image male110 posted 10 years ago in General
declare i int ;
/* SQL Error: 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 i int' at line 1 */
ansgar's profile image ansgar posted 10 years ago
That declare syntax is only valid in stored programs, see the MySQL docs.

To define a variable in a session you have to do it this way:
SET @myvar=1;
SELECT @myvar;
kapitannwel's profile image kapitannwel posted 10 months ago

hi @ansgar,

can you help me with this:

SELECT * FROM MyTable WHERE user_name LIKE '%VariableName%';

thank you very much.

Please login to leave a reply, or register at first.