This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL Server Management Studio.

SQL SERVER – Restricting Access to Contained Databases using Logon Triggers

November 18, 2014
Pinal Dave
SQL Tips and Tricks
SQL Trigger

Restricting access to contained databases: a DBA friend wanted to limit which users can connect, and logon triggers can do that. Here is how.

Read More
Upside-down glazed bowl showing its original clay foot ring

Audit Triggers That Record the Real User Behind EXECUTE AS

October 28, 2014
Pinal Dave
SQL Tips and Tricks
SQL Audit, SQL Server Security, SQL Trigger

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.

Read More
A spring catch holds one gate closed while a neighboring gate stays open

A Server Trigger That Blocks Accidental Database Drops

November 18, 2013
Pinal Dave
SQL Tips and Tricks
DBA, SQL Backup and Restore, SQL Trigger

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.

Read More
A rose branch pressing a red doorbell in the wind with nobody at the door.

UPDATE() in a Trigger Is True Even When Nothing Changed

September 21, 2013
Pinal Dave
SQL Tips and Tricks
SQL Audit, SQL NULL, SQL Server, SQL Trigger

Understand why UPDATE() in a trigger fires for unchanged SET values and log only real changes with inserted and deleted row comparisons.

Read More
A cat with a red collar passes through a cat flap while a stray waits outside.

Enforcing Object Naming Rules With a DDL Trigger

June 8, 2013
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Server, SQL Trigger

Enforce procedure and index names with a DDL trigger, inspect EVENTDATA, audit rejected attempts, and list existing violations.

Read More
A line of standing dominoes interrupted by one solid wooden block set across the run.

SQL SERVER – How to Use Instead of Trigger

January 24, 2013
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Trigger

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.

Read More
Gouache painting: a wooden crate riding on a long luggage trolley through three open stone archways in a row, a small vermilion luggage tag tied to the crate's rope handle

CONTEXT_INFO: Passing a Value Through a Session

January 14, 2013
Pinal Dave
SQL Tips and Tricks
SQL Audit, SQL Scripts, SQL Trigger

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.

Read More
Previous 1 2 3 4 5 6 7 8 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com