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