I have large .sql files exported from MySQL, and try to import them to MS SQL(localDB) via
SQLCMD. But when I type in the following into Command-prompt:
sqlcmd.exe -S (localdb)\MSSQLLocaldb -i C:\Users\Administrator\Desktop\1\SQLQuery4.sql
I got the following error message:
Incorrect syntax near 'tblo'
I checked my .sql file, it seems SQLCMD can't understand double quotes
e.g.
INSERT INTO "tblo" VALUES (2,'DTT','10000286','Dp','y',2,38,'2010-02-22 11:03:51','2010-02-22 11:03:51');
However, it's fine with SSMS
Any idea to solve this problem?
I found a solution by myself: I can add --skip-quote-names flag when I dump data from MySQL
e.g.
mysqldump.exe -hlocalhost -uUserName -pPassword --compatible=mssql --no-create-info --skip-quote-names --skip-add-locks DataBase tblo > D:\Test\dump.sql
Result in dump.sql will be like:
INSERT INTO tblo VALUES (2,'DTT','10000286','Dp','y',2,38,'2010-02-22 11:03:51','2010-02-22 11:03:51');
So I can use this .sql to directly import data into MS SQL server via SQLCMD
sqlcmd -S (localdb)\MSSQLLocaldb -i D:\Test\dump.sql