Primary Key - Create table (select)
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.


Primary Key - Create table (select) Expand / Collapse
Author
Message
Posted 3/29/2006 1:16:20 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/29/2006 12:49:00 PM
Posts: 2, Visits: 1
Is it possible to set a PRIMARY KEY when I'm creating a table from a select statement?

Ex.:

CREATE TABLE TEST
AS (SELECT VAR1, VAR2, VAR3
FROM TABLE) WITH DATA;

Where VAR1 should be the PRIMARY KEY.

Tks,

Marc
Post #3874
Posted 3/31/2006 11:08:07 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 6/9/2008 2:55:55 PM
Posts: 185, Visits: 2
I don't believe that the syntax allows that, since the PRIMARY KEY specification is done along with specifying the columns of the table.

You can specify a UNIQUE PRIMARY INDEX though by doing this:

CREATE TABLE TEST
AS (SELECT VAR1, VAR2, VAR3
FROM TABLE) WITH DATA
UNIQUE PRIMARY INDEX(VAR1);

Hope that helps.

Barry
Post #3888
« Prev Topic | Next Topic »


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


All times are GMT -5:00, Time now is 12:38am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.734. 11 queries. Compression Disabled.