all groups > sql server msde > february 2006 >
You're in the

sql server msde

group:

Multi-field Index



Multi-field Index SAC
2/28/2006 11:43:21 AM
sql server msde: I'm using MSDE 2000.

How can I make a multi-field unique index? Doesn't seem to be a way.

Thanks.

Re: Multi-field Index SAC
2/28/2006 11:56:59 AM
Got it. Thanks.

[quoted text, click to view]

Re: Multi-field Index gerryR
2/28/2006 5:55:13 PM
care to share?


[quoted text, click to view]

Re: Multi-field Index gerryR
2/28/2006 9:40:55 PM
Thanks Hugo!


[quoted text, click to view]

Re: Multi-field Index Hugo Kornelis
2/28/2006 9:47:17 PM
[quoted text, click to view]

Hi Gerry,

To create a UNIQUE constraint on more than one columns:

CREATE TABLE Demo
(Col1 int NOT NULL PRIMARY KEY,
Col2 int NOT NULL,
Col3 int NOT NULL,
CONSTRAINT uq_demo UNIQUE (Col2, Col3)
)

Or, if the table already exists:

ALTER TABLE Demo
ADD CONSTRAINT uq_demo UNIQUE (Col2, Col3)

To add a unique index:

CREATE UNIQUE INDEX ix_demo ON Demo (Col3, Col2)

--
Re: Multi-field Index SAC
3/1/2006 9:48:33 AM
In Database Design...add a table. Right click it and set the indexes.

[quoted text, click to view]

AddThis Social Bookmark Button