Auditing data changes requires choosing whether you need old values, new values, actor identity, or a change feed, then testing the cost.
SQL SERVER – Restricting Access to Contained Databases using Logon Triggers
Restricting access to contained databases: a DBA friend wanted to limit which users can connect, and logon triggers can do that. Here is how.
Audit Triggers That Record the Real User Behind EXECUTE AS
Your audit table says dbo for every change, and nobody can tell who really did it. Here is how to capture the person behind EXECUTE AS.
A Server Trigger That Blocks Accidental Database Drops
A server trigger can turn a wrong-tab DROP DATABASE into an error message. Here is a small demo that guards one name and removes itself at the end.
UPDATE() in a Trigger Is True Even When Nothing Changed
Understand why UPDATE() in a trigger fires for unchanged SET values and log only real changes with inserted and deleted row comparisons.
State Machine in T-SQL: Allowed Status Changes for an Order
A state machine in T-SQL keeps the allowed status changes in a table and rejects every other change. This post builds one for orders with a transitions table and a trigger, then tests a bad jump, several rows in one UPDATE, new orders, a transaction and a new rule. Every result comes from SQL Server 2025.
Enforcing Object Naming Rules With a DDL Trigger
Enforce procedure and index names with a DDL trigger, inspect EVENTDATA, audit rejected attempts, and list existing violations.






