Hello

SC My goal is that on an insert only the insertedby value is provide. The 
SC trigger will set that to the updatedby, insertedon and updatedon 
SC fields.  I searched the web and the only examples I could find was of 
SC an AFTER INSERT, am I better off with that approach?  I would think 
SC not.

How about using default values when you create the table, e.g.

CREATE TABLE Customer (
        CustomerId INTEGER PRIMARY KEY AUTOINCREMENT,
        IsInSlideShow INTEGER NOT NULL,
        Username CHAR(50) NOT NULL,
        Password CHAR(50),
        insertedby CHAR(50) NOT NULL,
        instertedon DATE DEFAULT CURRENT_DATE,
        updatedby CHAR(50) NOT NULL,
        updatedon DATE DEFAULT CURRENT_DATE,
        UNIQUE (username));

You can then do an insert as:

INSERT INTO Customer (insertedby, updatedby) VALUES('me', 'me');

i.e. pass the same value for both columns.

Hope this helps.

Swithun.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to