A SQL script library saves you from solving the same problem twice. This post shows a folder layout by task, a header block with the tested version, naming habits, a safe history, tests on a scratch server and a way to retire old scripts, with one small read-only script as an example.
Linting T-SQL: Rules Worth Automating in a Build
Use linting T-SQL to flag repeatable code risks, review catalog-based candidates, and automate confirmed rules without false certainty.
The sp_ Prefix: Finding Stored Procedures Named the Risky Way
Find user procedures with the sp_ prefix across databases, understand the lookup risk, and move callers through a synonym safely.
A T-SQL Formatting Style Guide for Teams
Adopt a short T-SQL formatting style with clear columns, joins, aliases, semicolons and comments, and keep review focused on query behavior.
Refactoring Old T-SQL One Procedure at a Time
Begin refactoring old T-SQL with one procedure, repeatable inputs, duplicate-aware result checks, measured reads, and a simple change log.
Stale Views: Why SELECT * Breaks After ALTER TABLE
Reproduce stale views after SELECT star and ALTER TABLE, find candidate definitions, refresh with sp_refreshview, and prevent the pattern.
AND Before OR: Operator Precedence in WHERE Clauses
A report showed closed orders even though the filter said open. The reason is how SQL Server groups AND and OR.







