Unique Clusered Index

  • Hi All,

    SQL Server 2000 allows me to create a Unique Clusered Index or a Unique Clusered Constraint.

    What is the difference?

    Thanks,

    -Kevin

  • An index is sorted, a constraint is not.  Both will have statistics.  Index will be used for data lookup.

    Tom

  • You might want to read SQL Server's Online Help on both topics or search the fora here.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • The BOL states that "SQL Server automatically creates a UNIQUE index to enforce the uniqueness requirement of the UNIQUE constraint."

    So if a clustered unique index is implicitly created along with the constraint I still am confused as to what the effective difference would be.

  • Hi Kevin

    As I understand it, a constraint has to do with inputting data into the table. If the constraint is unique, you would not be able to insert a record that would violate the condition. But the constraint is not used for data retrieval.

    An index, on the other hand, is used for data retrieval. A unique index is, I think, an index with a constraint.

    Schalk

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

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