The DATEPART function returns a week number according to its week definition. I choose that convention before using calendar logic.
Finding Orphaned Child Rows Before Adding a Foreign Key
Find orphaned child rows before adding a foreign key, review their business meaning, validate relationships, and confirm constraint trust.
How to Attach a Database Without Log File in SQL Server
To attach a database without log file, run CREATE DATABASE with FOR ATTACH_REBUILD_LOG, or remove the missing log in the SSMS Attach dialog. This tutorial builds a demo database, detaches it, and rebuilds the log on attach. It also explains when the rebuild is impossible and what to check afterward.
Listing Last Night’s Failed Agent Jobs With One msdb Query
List failed Agent jobs and steps from msdb history, include retries and cancellations, and account for local times and trimmed records.







