Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 688585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:14:41+00:00 2026-05-14T02:14:41+00:00

I am interested in writing a trigger that would ignore queries from a specific

  • 0

I am interested in writing a trigger that would ignore queries from a specific SQL user but take action on all others. Is there any way to do this?

A note, though: the user will need to do some queries, so I will need to allow some queries/deletes/etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:14:42+00:00Added an answer on May 14, 2026 at 2:14 am

    If you have a trigger right now that you don’t want to fire (we have done this on audit triggers when moving large amounts of data), you can do something like at the start of the trigger:

    if (suser_sname() = 'somename') return
    

    If you wanted to do something differnt for just that person you would do something like:

    if (suser_sname() = 'somename) 
    BEGIN
        some code
    END
    ELSE
    BEGIN
        someother code
    END
    

    Note several things about this. Use this code with much caution. First if you can do what you need through security rights, it is a much better choice. Hardcoding someone’s name into a trigger can cause strange results at some later time when all have forgotten that you put it in there. If you need to do in the short term (to move 100,000,000 million records in batches over a time into a database without hitting the auidit triggers for example), then don’t forget to change it back when the project is done. You don’t want to not audit someone’s actions forever especially if you are auditing financial transactions. Further, doing something in a trigger will only work for insert/update/delete. You cannot prevent selects from a trigger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm interested in writing a SMTP mail server that just sends emails? I would
I'm interested in writing some Chrome compatible Greasemonkey scripts, but I'm finding that there
I'm interested in writing games (simple ones thankfully) that take advantage of the Adobe
I'm interested in writing software that depends on being able to identify that there
I am interested in writing separate program modules that run as independent threads that
Interested in writing an iPhone app but don't want to buy a mac or
I'm interested in writing javascript that will programmatically perform a screen capture of what
I was interested in writing some home-brew analytic solutions and all the click tracking
I'm interested in writing a boot loader for USB sticks that looks for a
I am interested in writing a program that calculates the value of Pi to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.