Most people ask how to keep leading zeros in SQL Server. This time a reader wanted to remove leading zeros and white space from a column, so here is a script.
Automating SQL Server Patching With PowerShell
Automating SQL Server Patching with PowerShell means staging a verified package, running Setup quietly, checking logs, and stopping on failure.
Restoring a TDE Protected Database on Another Server
Restore a TDE protected database on another SQL Server by moving its certificate and private key, then verify encryption state.
Storing UTC and Local Time Side by Side
Store UTC and local time consistently, preserve offsets, handle daylight saving changes, and filter timestamps with clear boundaries.
Change Logs as JSON: Old and New Values in One Column
Skip the audit table with a column for every field. One JSON payload per changed row is lighter, if you handle NULL and multirow updates correctly.
Checking Certificates That Expire Soon in Every Database
Nobody remembers who created that certificate. Here is a short loop that lists every certificate expiring soon, and what to ask about each one.
Window Functions Over GROUP BY Results: SUM of SUM Explained
Why does SUM(SUM(Amount)) OVER () work? Because the window runs after GROUP BY. A short demo with shares, ranks and a filter trap.







