views:

50

answers:

2

i am using sql server 2000 i want to create a table having id as primary key and one more column having unique key constraint.

A: 
CREATE TABLE [MyTable]
(
    ID INT NOT NULL,
    SomeUniqueColumn varchar(20) NOT NULL,

    CONSTRAINT PK_MyTable PRIMARY KEY(ID),
    CONSTRAINT U_MyTable UNIQUE(SomeUniqueColumn)
)
nonnb
A: 

This should do that.

CREATE TABLE [dbo].[TestTable]
(
    [id] [int] NOT NULL,
    [otherValue] [int] NOT NULL,
 CONSTRAINT [IX_OtherValye] UNIQUE NONCLUSTERED 
(
    [otherValue] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
MonkeyWrench