----- Original Message ----- 
From: "tcronj" <[EMAIL PROTECTED]>
To: "sql-users" <[EMAIL PROTECTED]>
Sent: Thursday, February 12, 2004 6:06 PM
Subject: [sqlite] help with triggers


> I'm trying to add 2 triggers to my database.

> -- Trigger 1
> -- update the inv.audit with current datetime() whenever record inserted
or updated
> --
> CREATE TRIGGER upd_audit ON UPDATE, INSERT OF inv
>    BEGIN
>        UPDATE inv set audit = select datetime('now');
>    END
>
> -- Trigger 2
> -- add  all  itm.amount  where  itm.idinv = inv.idinv and update inv.total
> --
> CREATE TRIGGER tally_inv_total ON UPDATE, INSERT, DELETE OF itm
>    BEGIN
>        UPDATE inv set total = select sum(itm.amount) where itm.idinv =
inv.idinv;
>    END
>

You need to add semicolons after the END keywords in both of your triggers.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to