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. 

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#DATET
IME

> 
> 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: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?
unsub=illyeslaszlo@stripped


Laszlo Illyes
Teaching-assistant
Sapientia University
(Csikszereda) Miercurea-Ciuc
Tel:+40266317310
Fax:+40266317310/+40266371121
Mobil:+40740055706
E-mail: illyeslaszlo@stripped

Thread
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