Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Unique Index?

Author  Topic 

ddamico
Yak Posting Veteran

76 Posts

Posted - 2011-11-14 : 13:09:41
Good afternoon,

I have a partitioned table and created and the clustered primary key is DateKey,TransactionId (TransactionId is identity)

There is a unique 4 part key that makes a distinct transaction

Store,DateKey,BatchKey,HdrTxnKey
In order to link to other tables (i.e. header details) I need to use the 4 part key. My question is since the DateKey is in the clustered index do i need to include it in my unique index since its already part of the clustering key?

Any feed back would be great, thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-14 : 13:14:29
datekey is a part of pk so you cant guarantee that datekey will be unique of its own. so if you want to guarantee the unqiueness of Store,DateKey,BatchKey,HdrTxnKey combination you need to add it also to index

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -