0

I have a problem with sqlite2 (not sqlite3, because I use php).

I tried to create a table with the following query:

CREATE TABLE Messaggi (id INTEGER PRIMARY KEY AUTOINCREMENT,content TEXT, date DATETIME DEFAULT (date('now')), owner TEXT, viewed INTEGER DEFAULT (1))

But when I launched the script, this output was produced:

near "AUTOINCREMENT": syntax error

Where's the error?

Ok, I handle it. But now, i get this error:

near "(": syntax error

, with the query:

CREATE TABLE Messaggi (id INTEGER PRIMARY KEY DEFAULT('(SELECT COUNT(*) FROM 
Messaggi)+1'),content TEXT, date DATETIME DEFAULT (strftime('%s','now')), owner TEXT, 
viewed INTEGER DEFAULT (1)) 
donadev
  • 439
  • 2
  • 7
  • 17

0 Answers0