I am trying to import SQL scripts by going to File --> Load SQL File ... and then selecting my sql script. The script loads in a new query window but when I press F9 I get the following error message.
/* Loading file "C:\Users\Me\Desktop\refscan.sql" (4.7 KiB) into query tab #2 ... */
CREATE DATABASE IF NOT EXISTS "refscan";
/* SQL Error (102): Incorrect syntax near the keyword 'IF'
Incorrect syntax near 'refscan'. */
/* Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 0 of 13 queries: 0.000 sec. */
If I use Heidi SQL to export a database and then try to import it back I get the same problem.
Where am I going wrong?
SQL import problem
I guess you are not importing into a MySQL database, right?
Apart from that, if it's MySQL, your database name refscan is quoted with doublequotes, which is not supported by MySQL (as long as you don't have ANSI mode on). You need to use backticks:
Apart from that, if it's MySQL, your database name refscan is quoted with doublequotes, which is not supported by MySQL (as long as you don't have ANSI mode on). You need to use backticks:
CREATE DATABASE IF NOT EXISTS `refscan`;
Please login to leave a reply, or register at first.