Unique Index vs. Unique Constraint

  • I have been having trouble locating the answer to a question. When I add a Unique Constraint to a field on a table, does that automatically create a Non Clustered Index on that field?

    Thanks

  • meichner (12/12/2007)


    I have been having trouble locating the answer to a question. When I add a Unique Constraint to a field on a table, does that automatically create a Non Clustered Index on that field?

    Thanks

    Yes, at least in SQL Server 2000 and 2005. I cannot speak for earlier versions or other flavors of SQL, but in those two at least a unique constraint is enforced by creating a unique index. There is a reference at http://msdn2.microsoft.com/en-us/library/ms177420.aspx

    Edited to add the url tag I forgot the first time.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • Thanks for the fast response.

Viewing 3 posts - 1 through 2 (of 2 total)

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