A reader upgraded SQL Server and wanted to convert old RAISEERROR to THROW. I show the same error handled both ways, before and after SQL Server 2012.
SQL SERVER – Validating If Date is Last Day of the Year, Month or Day
A reader asked how to check if a date is the last day of the year, month or week. There is no built-in function, so here is the one I wrote.
SQL SERVER – Script to Find First Day of Current Month
Michael Usov suggested a quick way to find the first day of current month while keeping the DATETIME datatype, with or without the time part.
Making Online Learning Stick
Making online learning stick takes practice beside each video, short notes, spaced review, and one finished project that uses the skill.
SQL SERVER – Finding Out What Changed in a Deleted Database – Notes from the Field #041
What changed in a database that no longer exists? Brian Kelley shares a real story on finding out what changed in a deleted database.
Finding Databases Owned by Personal Logins and Fixing Them
Find databases owned by personal logins, review an approved replacement owner, and test dbo mapping and execution-context effects.
Post-Restore Checklist: Owner, Trustworthy, Broker and Users
The restore finished with no errors, yet the app cannot connect. Here are the four settings a restore quietly changes, and how to fix them.
REGEXP_LIKE Performance: Why Pattern Filters Cannot Seek
A short pattern can run a long CPU bill. Here is why REGEXP_LIKE scans, and how a plain prefix filter gives the index something to seek.
Every Deployment Script Needs a Tested Undo Script
Write and test an undo script before deployment, preserve old module text and changed rows, and identify changes that require recovery.
First and Repeat Purchases: Tagging Customer Orders With ROW_NUMBER
Tag repeat purchases with deterministic order numbering, calculate days to the second order, and compare customer cohorts fairly.










