July 31, 2004 at 1:17 am
How can i create the primary key constraint when two columns is required for PK as under
ColumnName |
Type |
Comments |
Segment_Id |
Int4 |
Segment ID and snapshot_id combination is primary key. |
Snapshot_id |
Int4 |
Snapshot ID (running number within each segment_id) |
August 1, 2004 at 7:29 am
How about one of these?
CREATE TABLE TestTable2
(Segment_Id int,
Snapshot_id int,
CONSTRAINT TestTable_SegmentSnapshot_pkc PRIMARY KEY CLUSTERED (Segment_Id, Snapshot_id) )
CREATE TABLE TestTable3
(Segment_Id int,
Snapshot_id int,
CONSTRAINT TestTable_SegmentSnapshot_pkn PRIMARY KEY NONCLUSTERED (Segment_Id, Snapshot_id) )
The first creates a clustered primary key and the second is non-clustered.
August 1, 2004 at 1:11 pm
Enterprise Manager makes it pretty easy to do. Good way to learn the syntax is do something in EM, then generate the create script.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply