> 
> Quite often I'd like to duplicate an existing table using SQL. Normally I'd 
> do a
> 
> create table NewTable select * from OldTable;
> 
> and if I don't want any data transferred I'll slap on a Limit 0 on the end
> of the statement.
> 
> This works fine except it doesn't create any indexes that OldTable had. Is
> there a generic way to duplicate a table that includes the indexes? I don't 
> want to have to manually create indexes for it.
take output from 
show create table OldTable;
 change the name of the table to New Table and, if you want to transfer data do insert 
into NewTable as select * from OldTable;

-- 
_/        _/  _/_/_/  -----     Rafał Jank [EMAIL PROTECTED]     -----
 _/  _/  _/  _/   _/         Wirtualna Polska SA   http://www.wp.pl 
  _/_/_/_/  _/_/_/    ul. Traugutta 115c, 80-237 Gdansk, tel/fax. (58)5215625
   _/  _/  _/         --------==*  http://szukaj.wp.pl *==----------

---------------------------------------------------------------------
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