Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread "select into" ???
Sun, Feb 1 2009 10:38 AMPermanent Link

Van de moortel, Koen
Why doesn't this seem to work?
I thought this was standard SQL?

SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_tablename
Sun, Feb 1 2009 11:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

It possibly was up to SQL2003 (I used to use it a lot to create in memory tables) but its been replaced by CREATE TABLE AS


Your statement would need to be replaced by

CREATE TABLE new_table_name AS
SELECT * FROM old_table_database.old_tablename

Also CREATE TABLE AS has to be executed from the context of the database you need to create the table in.

Roy Lambert [Team Elevate]
Sun, Feb 1 2009 11:37 AMPermanent Link

Van de moortel, Koen
Thanks!
Sun, Feb 1 2009 11:51 AMPermanent Link

Van de moortel, Koen
Apparently something is missing. when I do this:

CREATE TABLE copytable AS
SELECT *
FROM origtable

I get error 700 (missing "WITH")

???
Sun, Feb 1 2009 12:18 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Yes. You must indicate if you want the table to be created with or
without data:

CREATE TABLE copytable AS
SELECT *
FROM origtable
WHITH DATA

or

CREATE TABLE copytable AS
SELECT *
FROM origtable
WHITH NO DATA


--
Fernando Dias
[Team Elevate]
Image