开发者

SQL Server Disabling All Triggers - Cannot find the object "XXXX" because it does not exist or you do not have permissions

开发者 https://www.devze.com 2023-03-30 16:17 出处:网络
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 permis

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 underst开发者_StackOverflow社区and 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.


sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER all'

To enable all triggers, you can use following statement

sp_msforeachtable 'ALTER TABLE ? ENABLE TRIGGER all'


Not sure why Yuck deleted their answer. From DISABLE TRIGGER:

object_name Is the name of the table or view on which the DML trigger trigger_name was created to execute.

That is, you can't provide a database name to this statement. Whilst the MYDB database exists, there isn't an object within it called MYDB.


use MYDB;
disable trigger all on DATABASE;
0

精彩评论

暂无评论...
验证码 换一张
取 消