Oláh,
Thursday, December 05, 2002, 2:44:24 PM, you wrote:

OB> I want to copy one table's structure to another (non existing) table, but i
OB> didn't find any command or example to do that. Exactly, the situation is the
OB> following:
OB> A dynamic database structure has tables. We want to copy any of tha tables
OB> (while we don't know that table's structure) to another template table,
OB> which isn't exist. So, that looks like on MsSQL:

OB> "SELECT * INTO [temptablename] FROM [sourcetablename] WHERE id is null"

OB> and the SQL server creates a [temptablename] table with no records (or we
OB> hope that ;) )
OB> But we can't do this on MySQL server, 'cause MySQL isn't know the
OB> "SELECT...INTO" syntax, but in the INSERT...INTO syntax, we must count the
OB> columns, which we wnat to create. (it's not good for me...)

OB> Can somebody solve this problem? Or it's willn't work for the next version?
OB> (uhh-uhh, thats the worst...)

You can use:
  CREATE TABLE new_table SELECT * FROM old_table LIMIT 0;

but you must create indexes manually.



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





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