title: What is the difference between a unique constraint and a unique index
body: <p>What is the difference between the following two statements?</p>
  
  <pre><code>alter table [dbo].[Demo] add constraint [UC_Demo_Code] unique ( [Code] )
  go
  create unique nonclustered index [UK_Demo_Code] on [dbo].[Demo] ( [NB_Code] )
  go
  </code></pre>
  
  <p>Does the constraint have an index to help it enforce uniqueness, or will a table scan be performed on every insert/update?</p>