A Jr. DBA at my company changed my integer check so it accepts only a positive integer. I share his udf_IsNatural function with a few test values.
SQL SERVER – Difference Between UPDATE and UPDATE() in Triggers
UPDATE changes rows in a table or view, while UPDATE() in triggers tells you if a column was part of an INSERT or UPDATE. Here is the difference.
SQL SERVER – 2005 – List All The Constraint of Database – Find Primary Key and Foreign Key Constraint in Database
A simple script from my archive lists all constraints from sys.objects, so you can check each foreign key and primary key constraint in database tables.
Writing T-SQL Somebody Else Can Maintain
Write maintainable T-SQL with clear names, explicit results, focused procedures, and comments that explain the business reason behind the code.
SQL SERVER – Difference Between EXEC and EXECUTE vs EXEC() – Use EXEC/EXECUTE for SP always
What is the difference between EXEC and EXECUTE? None. The real difference is EXEC vs EXEC(), and I show why EXEC belongs before every stored procedure call.
COUNT_BIG: Count Rows and Non-NULL Values as bigint
COUNT_BIG helps me name the counting rule before reading the result. Compare rows, supplied values and distinct readings. Then check empty results and the bigint return type.
FORMATMESSAGE: Build a Message Without Raising an Error
FORMATMESSAGE returns formatted text without raising an error. Match placeholders to typed arguments and keep formatting separate from control flow.







