On 5 Dec 2002, at 14:44, Ol h Barnab s wrote:

> "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...)

If I understand you correctly, the query you want is

   CREATE TABLE temptablename SELECT * FROM sourcetablename LIMIT 0;

The only problem is that indexes and some other properties of the
source table (defaults, for example) are not copied over, but I
imagine that happens with your MS SQL statement as well.  If you need
to preserve those things, you'll have to take the output from "SHOW
CREATE TABLE sourcetablename", change the table name in the SQL, and
execute the new statement.

--
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org
Phone 202-667-6653

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