Reputation: 2870
Im trying to alter my table "Materiel" for make a primary key.,but this instruction is not working.
ALTER TABLE "MATERIEL" ADD CONSTRAINT "MATERIEL_PK" PRIMARY KEY ("MATRICULE")
This is stack trace:
[00:22:39] Error while executing SQL query on database 'Data': near "CONSTRAINT": syntax error
Upvotes: 3
Views: 6819
Reputation: 2482
That won't work as that syntax is not supported by SQLite3 (see https://sqlite.org/lang_altertable.html). To do this, you need to re-create the table to include the constraint.
Upvotes: 4