• a unique index is just that: a constraint and index that prevents duplicate values.

    unique means you can't have 2 nulls in the table., one NULL max.

    it is up to you to decide whether it is a clustered index or not when you create it; the clustered index decides in what order the data will be stored, so queries using that column in the WHERE statemetn will be the fastest:

    CREATE TABLE TBSTATE(STATEID INT,STATECODE CHAR(2) )

    --both of these are valid

    ALTER TABLE TBSTATE ADD CONSTRAINT UQ_STATECODE UNIQUE CLUSTERED(STATECODE)

    ALTER TABLE TBSTATE ADD CONSTRAINT UQ_STATECODE UNIQUE NONCLUSTERED(STATECODE)

    --or

    ALTER TABLE TBSTATE ADD CONSTRAINT UQ_STATEID UNIQUE CLUSTERED(STATEID )

    ALTER TABLE TBSTATE ADD CONSTRAINT UQ_STATEID UNIQUE NONCLUSTERED(STATEID )

    so if most searches on this simple table are on STATECODE, it makes sense to put the clustered index on that....but if most searches are on STATEID, then the clusted index belongs on that instead.

    does that help a bit?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!