BlueSkyFalling
BlueSkyFalling

Reputation: 3

I keep getting syntax errors when I can't find anything wrong

Probably a stupid question, but I'm just trying to make a new table in my database called 'projects'. I can't find any syntax errors, but every time I try to run it it says there is a syntax error on the final line sqlite3.OperationalError: near "MAX": syntax error. The table is not created, and it works without the pjct_pic varbinary(MAX) not null . The table should be created but every time I run it it just churns out the same error.


connie = sqlite3.connect('eeg.db')
c = connie.cursor()



c.execute("""
CREATE TABLE IF NOT EXISTS projects(
id INTEGER PRIMARY KEY AUTOINCREMENT,
pjct_name TEXT,
pjct_nick TEXT,
pjct_time TEXT,
pjct_pic varbinary(MAX) not null
)
""")

Upvotes: 0

Views: 261

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521987

The VARBINARY(MAX) type is available on SQL Server, but not SQLite. On SQLite, the closest actual type would be BLOB. There might be an affinity in SQLite to which varbinary would map, but that affinity would be BLOB. So, I recommend just using this create statement:

CREATE TABLE IF NOT EXISTS projects (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    pjct_name TEXT,
    pjct_nick TEXT,
    pjct_time TEXT,
    pjct_pic BLOB NOT NULL
);

Upvotes: 2

Related Questions