I sent this last night, but it didn't post on the list. Trying again to make
sure this is working.
------ Original Message ------
Received: 08:40 PM MDT, 08/27/2009
From: [email protected]
To: General Discussion of SQLite Database <[email protected]>
Subject: Re: [sqlite] Conditional triggers
Yes, you should be able to do this but I think your conditions need to be:
when new.TypeID = 1
and
when new.TypeID = 2
I'm sure you saw this, but note the WHEN clause and text in the document
concerning when you can reference new and old values for the columns.
http://www.sqlite.org/lang_createtrigger.html
------ Original Message ------
Received: 08:27 PM MDT, 08/27/2009
From: Dennis Volodomanov <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [sqlite] Conditional triggers
Hello all,
Is it possible to create such an AFTER INSERT trigger
that updates certain fields in a table based on the actual data being
inserted?
Let's say:
CREATE TABLE abc(TypeID INTEGER)
CREATE TABLE abcCount(TypeCountA, TypeCountB)
CREATE TRIGGER CountTypeA AFTER INSERT ON abc /* when
abc.TypeID == 1 */ BEGIN
UPDATE abcCount SET TypeCountA=TypeCountA+1; END
CREATE TRIGGER CountTypeB AFTER INSERT ON abc /* when
abc.TypeID == 2 */ BEGIN
UPDATE abcCount SET TypeCountB=TypeCountB+1; END
Is something like that possible? I couldn't find any
syntax construct I could put in place of the comment.
Thanks in advance,
Dennis
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users