Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Federico Iori,
In datawarehouse slowly changing dimension with surrogate key are often used. It may happen, because of ETL poorly designed or other reasons, that ETL loads record not correctly versioned, violating the rule "for each unique value of the natural key there should be only one value of the surrogate key".
It would be nice to define a database constraint to enforce such an uniqueness , in Sql Server is not intuitive but is possible using a clustered unique index defined on an indexed view , defined as aggregate select.
In practice, the indexed view let us define an unique constraint based on aggregate select .
In the last blog post I have talked about unique/non-unique clustered indexes on a heap
table. A ta...
Unique index in sql server 2005
unique clustered index on 2 columns
In the last weblog
post I have talked about the difference of unique and non-unique clustered indexe...