Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to be able to build a trigger that checks the ApplicationName coming across on a transaction, and if the ApplicationName is of a certain value, then I want to throw an error, saying the user is not allowed to make this transaction.

Is there a way to create this script?

share|improve this question

Yes, you can use the APP_NAME() function in SQL.

This is set in the connection string though so it isn't reliable

Why not limit users? If a user has permissions, they can run msqry32 which is on any PC with Office installed, set a connection string using ODBC and make it look like what they want...

share|improve this answer
+1 for "isn't reliable" – a_horse_with_no_name Feb 2 '12 at 21:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.