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
2010-08-06 11:16:28
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
2010-08-06 11:23:20