Dear Oláh,

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

In MySQL, you simply do:

CREATE TABLE temptable SELECT * FROM sourcetable LIMIT 0

That's even simpler, 100% reliable and FAST! :)

HTH!
--
  Stefan Hinz <[EMAIL PROTECTED]>
  Geschäftsführer / CEO iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3


----- Original Message -----
From: "Oláh Barnabás" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 1:44 PM
Subject: Table copy problem


> Hello!
>
> I want to copy one table's structure to another (non existing) table,
but i
> didn't find any command or example to do that. Exactly, the situation
is the
> following:
> A dynamic database structure has tables. We want to copy any of tha
tables
> (while we don't know that table's structure) to another template
table,
> which isn't exist. So, that looks like on MsSQL:
>
> "SELECT * INTO [temptablename] FROM [sourcetablename] WHERE id is
null"
>
> and the SQL server creates a [temptablename] table with no records (or
we
> hope that ;) )
> But we can't do this on MySQL server, 'cause MySQL isn't know the
> "SELECT...INTO" syntax, but in the INSERT...INTO syntax, we must count
the
> columns, which we wnat to create. (it's not good for me...)
>
> Can somebody solve this problem? Or it's willn't work for the next
version?
> (uhh-uhh, thats the worst...)
>
> Thanx,
> Barnabas Olah
> Cegedim Hungary
>
>
>
> ---------------------------------------------------------------------
> 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
>


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