I believe it would be enough if you wrote something like this:
CREATE TRIGGER trigger_delete Before DELETE ON table1
BEGIN
INSERT INTO backup_table(oldid, sql, tablename, operation)
VALUES (old.rowid, "INSERT INTO table1 values
("||old.rowid||","||old.column1||","||...||old.lastColumn||")" , "table1",
1);
END
Basically, instead of "sql" you would put in a concatenated string formed
like the one above using the || operator.
Hope this helps
Vladimir Stokic
Marco Bambini wrote:
>
> I need to create a trigger that BEFORE a row is deleted from a table,
> the sql used to create that row (or a way to recreate it) should be
> saved to another backup table.
> For example:
>
> CREATE TRIGGER trigger_delete Before DELETE ON table1
> BEGIN
> INSERT INTO backup_table(oldid, sql, tablename, operation)
> VALUES (old.rowid, "sql", "table1", 1);
> END
>
> The missing field is "sql" ... do you have a smart idea to solve my
> problem?
> Thanks.
> ---
> Marco Bambini
> http://www.sqlabs.net
> http://www.sqlabs.net/blog/
> http://www.sqlabs.net/realsqlserver/
>
>
>
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
>
>
>
--
View this message in context:
http://www.nabble.com/Advice-about-a-trigger-tf4568708.html#a13177002
Sent from the SQLite mailing list archive at Nabble.com.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------