A diagram of an existing database starts with real foreign keys, uses SSMS to reveal relationships, and records the important paths a picture misses.
SQL SERVER – Generate Foreign Key Scripts For Database
Madhaiyan Seenivasan’s stored procedure lets you generate foreign key scripts for a whole database, handy when you drop all foreign keys and add them back.
SQL SERVER – Add Column With Default Column Constraint to Table
Add a NOT NULL column with a named default Column Constraint in one ALTER TABLE statement. I always name constraints instead of letting SQL Server pick one.
Salary Ranges: Match Overlapping Intervals in SQL Server
Match salary ranges using both boundaries of the job and candidate intervals. Define open bounds and test containment, endpoint contact and invalid input.
Check Constraints That Enforce Business Rules
Check constraints keep row rules inside SQL Server, but NULL behavior and trusted status determine how much protection they provide.
SQL SERVER – TempDB Restrictions – Temp Database Restrictions
TempDB Restrictions follow from how SQL Server recreates and uses this system database. I check them before applying user-database maintenance habits.
SQL SERVER – Three T-SQL Script to Create Primary Keys on Table
Three T-SQL scripts to create primary keys: two while creating the table and one with ALTER TABLE later, where the column must first be NOT NULL.






