Create temporary table
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Create temporary table Expand / Collapse
Author
Message
Posted 7/6/2009 9:04:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/30/2009 7:25:08 AM
Posts: 9, Visits: 30
I need to create a temporary table using as source a portion of another table from my TeraData DataBase.
The temporary table must have the same definition of the source table.

I know what the syntaxe would be like in SQLServer:
"Select top 10 * into TempTable from SourceTable"

But when I try this in TeraData I get the error message:
Syntaxe error: INTO clause is not allowed.

Can anybody help me to solve this problem or find another way to do the trick?

Thanks in advance.
Rodrigo.
Post #16048
Posted 7/6/2009 9:31:03 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 10/22/2009 10:24:19 AM
Posts: 39, Visits: 213
Try INSERT INTO TempTable SELECT TOP 10 * FROM SourceTable if TempTable is created beforehand.

Try CREATE TABLE AS... syntax if not.

HTH

Cheers.

Carlos.
Post #16050
Posted 7/6/2009 9:36:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/30/2009 7:25:08 AM
Posts: 9, Visits: 30
Never mind answering, guys, I have already found out how to do what I need.

Just to register here the solution I came up with (and hopefully help anyone who eventualy stumbles in this issue):
"CREATE TABLE tempTable AS (select top 10 * FROM sourceTable) WITH data;

Note: The version 12 of TeraData does not support this construction for sourceTables containing Identity Columns =/ I hope they fix that for newer versions...

Regards.
Rodrigo.
Post #16051
Posted 7/6/2009 9:38:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/30/2009 7:25:08 AM
Posts: 9, Visits: 30
Hehehe that is just what I did, Carlos!

Thanks, anyway.
;)

Rodrigo.
Post #16052
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 1 ( 1 guest, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 8:06pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.031. 7 queries. Compression Disabled.