List:General Discussion« Previous MessageNext Message »
From:Illyes Laszlo Date:October 8 2003 6:35am
Subject:Re: Can records be moved between tables without knowing columns
View as plain text  
On Tue, 7 Oct 2003 16:48:55 -0400, Jim wrote
> Hi,
> I need to be able to 'delete' records from table(s) but still 
> maintain their information for an audit trail.
> I'd rather not have a field for a deleted flag and have to condition 
> all the queries on the table on the state of this flag.
> Is it possible to move a record from one table to another easily?
> Even better, can I do it opaquely (without knowledge of the columns)?
> Something
> like:
>     "move from LiveUsers to DeletedUsers where ID=?;"
> where all the fields in the first table get moved to the 
> corresponding field of the 2nd.  (If this is possible, what happens 
> with autoincrement, timestamp fields?)

In the second table (DeletedUsers you don't define the ID autoincrement.
Timestamp you can freeze, and you can try.

From ducumentation I cut for You:

Let MySQL set the column when the row is created. This will initialise it to 
the current date and time. 
When you perform subsequent updates to other columns in the row, set the 
TIMESTAMP column explicitly to its current value.

> Thanks for the help; I hope it isn't a trivial question.
> I'm new at this; I didn't find anything on moving records in the list
> archives.
> Jim Cant
> -- 
> MySQL General Mailing List
> For list archives:
> To unsubscribe:

Laszlo Illyes
Sapientia University
(Csikszereda) Miercurea-Ciuc
E-mail: illyeslaszlo@stripped

Can records be moved between tables without knowing columnsJim7 Oct
  • Re: Can records be moved between tables without knowing columnsDan Nelson7 Oct
  • Re: Can records be moved between tables without knowing columnsIllyes Laszlo8 Oct