On 15.08.2012 10:19, Yannick SILVA wrote: > I'm using DISQLite3 version 3.1.5 and Delphi XE2 on Windows 7 64Bits. > > It seems that I have a problem with the syntax of my TRIGGER but I can't > figure out what is it. > At the first FDb.Prepare16('SELECT * FROM TABLE2;') I get the message : > Project PROJECT1.exe raised exception class ESQLite3 with message > 'SQLite Error 11 - malformed database schema (updateCpdI) - near > "TRIGGER": syntax error'. Your SQL query executes without error when I run it. Are you using the free DISQLite3 Personal instead of the full DISQLite3? DISQLite3 Personal excludes some features, including triggers. The feature chart is available here: http://www.yunqa.de/delphi/doku.php/products/sqlite3/feature_chart Ralf > I created my database sqlite3 based on this sql file : > > PRAGMA synchronous = OFF; > PRAGMA journal_mode = MEMORY; > BEGIN TRANSACTION; > > CREATE TABLE "table1" ( > "ID" INTEGER PRIMARY KEY , > "TABLE2ID" int(11) NOT NULL, > "ITEM" text NOT NULL > ); > > CREATE TABLE "table2" ( > "ID" INTEGER PRIMARY KEY , > "ITEM" int(11) NOT NULL, > "CPT" int(11) DEFAULT NULL > ); > > > CREATE TRIGGER updateCptI AFTER INSERT ON table1 > BEGIN > update table2 SET cpt = (SELECT COUNT(TABLE1.ID <http://TABLE1.ID>) > FROM TABLE1 WHERE TABLE1.TABLE2ID = TABLE2.ID <http://TABLE2.ID>) WHERE > table2.ID = NEW.TABLE2ID; > END; > > END TRANSACTION; _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa