Unique NONCLUSTEREDCONSTRAINT

  • Hi

    How to add Unique NONCLUSTERED CONSTRAINT to the

    SQL Server 2005 table column?

    I got that using following syntax:

    ALTER TABLE

    ADD CONSTRAINT [name of constraint] UNIQUE NONCLUSTERED

    (

    [column name] ASC

    )

    But how to set it in sql server 2005 designer?

    Thanks in advance

  • Go into the table design view, right-click and select Indexes/Keys, click add new and change the Type to unique key.

  • just a heads up and my already know if you do not elect to add a UNIQUE NON CLUSTERED constraint

    SQL will elect to one on its own in the B+ tree. UNIQUE NON CLUSTERED constraint if possible make your unique NON CLUSTERED as one col and then use included columns ...this will reduce the root and intermediate nods and increase performance on on interest as well reduce fragmentation.

    good luck

  • Thanks alot.

    Thats what I was looking for.

    How to create unique constraint over multiple columns?

  • ALTER TABLE

    ADD CONSTRAINT [name of constraint] UNIQUE NONCLUSTERED

    (

    [column name1] ,

    [column name2] ,

    [column name3]

    )

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • 465789psw (9/22/2008)


    just a heads up and my already know if you do not elect to add a UNIQUE NON CLUSTERED constraint

    SQL will elect to one on its own in the B+ tree.

    Could you explain a bit more what you mean there please?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply