Diemauerdk
Diemauerdk

Reputation: 5958

How to use transactions in SQLite?

When i execute following SQL against an SQLite database:

BEGIN;
CREATE TABLE [Profile] (
[Id] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,
[ProfileExperimentId] INTEGER  NOT NULL,
[Name] NVARCHAR(50)  NOT NULL
)
COMMIT;

I get the following error:

27-03-2014 14:19:33: SQL Error: SQL logic error or missing database

I execute the SQL through an SQLite administrator tool.

If i execute the above sql without transactions the table is created.

Am i missing something? Thx in advance

Upvotes: 0

Views: 653

Answers (1)

laalto
laalto

Reputation: 152927

You need a semicolon ; to terminate the CREATE TABLE before COMMIT.

Upvotes: 4

Related Questions