Question

I want to run a sql statement on dbForge SQL window, but got error:

if (ifnull(null,'s') = 's') then
select 's';
end if;

Error:

1 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 'if (ifnull(null,'s') = 's') then
select 's'' at line 2 SQL1.sql 2 1

I have to put that statement within a stored procedure to test it.

How to run the statement directly on SQL window, like SQL Server management studio.

Was it helpful?

Solution

Of course you can run this in SQL Server Management Studio, because it is Sql Server.

Now, you trying to run this statements as a script in MySQL, and get an error. That is right, MySQL doesn't support IF, CASE, LOOP, WHILE and other flow control constructs in the script. You only can use them in stored procedures, functions, triggers and events.

Flow Control Statements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top