is it possible disable and enable a trigger by user / session?

Hello guys,

I need to do a process where I need to have two triggers disabled on the start process and after finishng it, start the trigger again without afecting the other users that is using the table.

is it possible? if so, how to?

thanks
alex
LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
You can do that by using below command.

--Disable
DISABLE TRIGGER ALL ON TableName;
GO

--Enable
ENABLE TRIGGER ON ALL TableName;
GO
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
Hi LVL,

Will that only aftect my session without aftect others users that are using  the same table?
0
Pawan KumarDatabase ExpertCommented:
You can disable triggers at the start of your work and enable after your work is done.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

hidrauAuthor Commented:
I also was looking for in google something about and I found out this article:

https://www.mssqltips.com/sqlservertip/1591/disabling-a-trigger-for-a-specific-sql-statement-or-session/

Maybe it is the better way, what do you thing?
0
Pawan KumarDatabase ExpertCommented:
Its the same thing.
0
hidrauAuthor Commented:
thanks a lot for your help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.