To show primary key columns for one table, call sp_pkeys with the table name. This post builds a small demo database, reads a single column and a composite key, and handles schemas and errors. It also lists every key in a database with one catalog query.
Foreign Key Checks in Insert Plans: The Cost of Each Constraint
Before you drop a foreign key to speed up a load, look at what it costs. This walk-through shows the Assert, the two parent lookups, and the trust trap.
Enforcing Formats With a REGEXP_LIKE Check Constraint
Stop badly shaped product codes before they reach a report. A short, tested walk-through of anchors, NULLs and adding the rule to old data.
What is Trusted Constraint in SQL Server? – Interview Question of the Week #210
What is a trusted constraint in SQL Server? Many experts do not know, so instead of a definition I explain it with a simple check constraint example.
Drop Multiple Tables with One DROP TABLE Statement
To drop multiple tables in SQL Server, list them in one DROP TABLE statement, referencing tables first. This post tests the order rule on a parent and child table and shows what happens after an error. It also covers IF EXISTS, drops by name pattern and temporary tables.
How to Create Primary Key Without ANY Index? – Interview Question of the Week #143
Question: How to create primary key without ANY index? SQL Server builds a clustered or nonclustered index for every primary key, so here is the answer.
SQL SERVER – How to Find UNIQUE Key Columns? – sp_special_columns
Want to know which columns uniquely identify a row in a table? The system stored procedure sp_special_columns tells you. Here is a quick demo.







