At 10:06 AM -0500 11/15/01, Anthony R. J. Ball wrote:
>  MySQL 3.23.41 on Solaris
>
>
>   Alright, I have a system where data comes in once... or maybe
>a few times a day. I use this data to recreate a table, and then
>I need to safely and quickly replace the old table. I was thinking
>lock original table, drop it, and then rename the new table, but
>I wasn't sure the lock would stay once the table was dropped. Is
>this the right way to go about it?

Use RENAME TABLE to rename them both in the same statement, then
drop the old one:

RENAME TABLE t TO t_old, t_new TO t;
DROP TABLE t_old;


RENAME TABLE is available as of MySQL 3.23.23.

>
>--
>  ___  __  __    __  _  _  ____    _  _  ____  ____
>/ __)(  )(  )  /__\( \/ )( ___)  ( \( )( ___)(_  _)
>\__ \ )(__)(  /(__)\\  /  )__)    )  (  )__)   )( 
>(___/(______)(__)(__)\/  (____)()(_)\_)(____) (__)
>Do not follow in the footsteps of men of old; seek what they sought.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to