I'm trying to run this command in SQL Server:
disable trigger all on MYDB
This is failing for me. The account I'm logged into has access to MYDB and I've pretty much giving it every single permission available (it's a local DB and my account only, so this is OK). I don't understand why it's telling me it can't find MYDB for this? I've done this before. Also note: I can select from the database, update, and run a grant statement (such as granting execution of a proc). I can also disable triggers manually...
So why does this fail? I was able to do it before...
Thanks.
To view database level triggers, Login to the server using SQL Server management studio and navigate to the database. Expand the database and navigate to Programmability -> Database Triggers. To view triggers at the server level, Login to Server using SSMS and navigate to Server Objects and then Triggers folder.
Use a combination of STUFF , REPLICATE and CHARINDEX . CHARINDEX will give you the position of a particular string inside another one (the first by default). REPLICATE will repeat a string N amount of times, we use this for the mask.
sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER all'
To enable all triggers, you can use following statement
sp_msforeachtable 'ALTER TABLE ? ENABLE TRIGGER all'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With