Should the Primary Key always be a clustered index? A design discussion about SSN numbers stored as strings and when a separate clustered index makes sense.
SQL SERVER – Disable CHECK Constraint – Enable CHECK Constraint
Need to disable CHECK constraint validation for a bulk load? Here is how, and how to enable it again with WITH CHECK CHECK CONSTRAINT, the syntax with CHECK twice.
Preventing Overlapping Date Ranges in a Table
Detect overlapping date ranges with joins and window queries, use half-open endpoints, and enforce the rule with a multirow trigger.
SQL SERVER – Difference Between Candidate Keys and Primary Key In Simple Words
The difference between candidate keys and primary key in simple words: any unique column can be a candidate key, but only one becomes the primary key.
SQL SERVER – Discussion – Effect of Missing Identity on System – Real World Scenario
Is there any real world reason to list a missing identity in a table? Readers had no new script, but a lively discussion on whether gaps matter.
Finding Duplicates Before Adding a Unique Constraint
A unique constraint fails on the first duplicate it meets and tells you about only one. Here is how to list them all and clean up safely.
SQL SERVER – Puzzle – Write Script to Generate Primary Key and Foreign Key
A puzzle from a migration project: SSMS cannot script every Primary Key and Foreign Key at once. Can you write a script that generates them all?







