Will a SELECT * FROM work there? I'm not using 5.x, so I haven't really
investigated triggers; this is just a guess.

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com


> -----Original Message-----
> From: Olaf Stein [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 30, 2007 2:05 PM
> To: MySql
> Subject: Trigger question
>
> Hey all,
>
> I asked this before (a while back) and have gotten some
> answers that solve
> my problem partially only.
>
> ------- old message ----------
>
> I have a table with 205 columns. When an update statement
> updates a row in
> this table I want a trigger that creates a record of the old row in a
> separate table.
> The following works fine when not too many columns need to be
> written into
> the other table
>
> CREATE TRIGGER track_table
> BEFORE UPDATE ON table FOR EACH ROW
> BEGIN
> INSERT INTO table_track (value1,value2) VALUES
> (OLD.value1,old.value2);
> END;
>
> Is the any way of using OLD for all columns or generally
> another way of
> doing this.
>
> ------- old message ----------
>
>
> One answer (thanks btw) suggested to do this:
>
> INSERT INTO table_track SELECT * FROM table WHERE key_col=OLD.key_col;
>
> This works fine, requires however that both tables have the
> same structure
> (nr of columns, order, etc). I would like to add an
> autoincrement ID and a
> timestamp to the record written by the trigger and do not
> want to have a
> timestamp field in the original table.
>
> Is there any other way of doing this?
> The only other idea I have (and I am not sure if this would
> even work) is to
> select the column headers from information_schema and loop
> through them
> building the actual insert statement.
>
> Thanks
> Olaf
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
>




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to