Syntax error while loading from file

I execute: sqlite3 -init mydata.sql mydb with the following line in mydata.sql:

 DROP TABLE IF EXISTS [Album]; 

I get the following error:

Error: next to line 1: next to "DROP": syntax error

I almost destroyed the input file, and I always get this syntax error message no matter what command I enter and always on line 1. It looks like he thinks there is some unusual character, but I see that it can Any thoughts?

+7
source share
2 answers

If you are using Notepad ++ or another similar text editor, enable the display of the entire character.

In Notepad ++, view-> show symbol-> Show all characters

Also check the encoding of this file (Menu-> Encoding). You can force the encoding to ANSI / UTF-8 (Menu-> Encoding-> Convert to ANSI).

+5
source

I had the same error with Chinook base and SQLite version 3.19.3, so I opened the SQL file ( Chinook_Sqlite_AutoIncrementPKs.sql ) with Sublime Text and saved it as UTF-8 (to exclude the indicator specification).

+1
source

All Articles