Triggers come in two kinds, Instead of and After. Here is how an Instead of Trigger can intercept an insert, update or delete on a table, with an example.
CONTEXT_INFO: Passing a Value Through a Session
CONTEXT_INFO lets you attach a small value to a session and read it anywhere in that session, even inside a trigger. This post tests SET CONTEXT_INFO on SQL Server 2025, uses it to log who changed a price, and compares it with SESSION_CONTEXT.
Audit Columns From Day One: CreatedAt, UpdatedAt and Who Changed It
Add audit columns with UTC timestamps and trusted change identities, maintain updates in procedures, and know when history is needed.
Summary Tables: Keeping Pre-Aggregated Totals Current
Keep summary tables current with changed-day rebuilds, handle late arrivals and deletes, and reconcile stored totals against detail.
MERGE Statement Pitfalls
MERGE statement pitfalls include duplicate source keys, concurrency races, trigger surprises, and complex actions that deserve testing.







