Skip to content
Advertisement

Simple Syntax Error in SQLite: “Error near line 1: near ”SQLite”

I am having a great deal of trouble with this seemingly simple issue. I can’t seem to get .read to work. Here is the code that I have tried: enter image description here

Any help would be greatly appreciated!

Advertisement

Answer

.open test.sql

This opens a Sqlite3 database (Creating a new one if the file doesn’t already exist) and attaches it as the main one in the sqlite3 shell session.

.read test.sql

This attempts to read a text file full of SQL statements and execute them one by one.

A sqlite database is not a text file full of SQL statements, hence the syntax errors when you try to treat it as one.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement