Build an every other week schedule in T-SQL, skip holiday dates, find the next occurrence, and check rota weeks from one anchor.
Drop Tables by Prefix in SQL Server and Azure SQL Database
To drop tables by prefix, list the matching tables first and drop them with a script that quotes every schema and table name. This post shows why the underscore in a prefix is a trap, a one-statement version and a cursor version. It works in SQL Server and in Azure SQL Database.
When was Table Accessed Last By User? – Interview Question of the Week #226
When was a table accessed last by a user? When clients say a table is rarely used, I run this report to check before we create or drop indexes.
SQL SERVER – How to Write Correlated Subquery?
A Correlated Subquery references the outer query. I use a stock-item comparison after the earlier single-table aggregate lesson.
How to Create an Empty Table and Fool Optimizer to Believe It Contains Data? – Interview Question of the Week #204
How do you create an empty table and fool the optimizer into thinking it has data? Nobody asked me that in 20 years, but I use this trick in Health Checks.
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.
Disk Space Needed to Build a Clustered Index on a Big Table
A clustered index build holds the old table and the new index at the same time. Here is a small demo of that peak, and what to check first.







