Question

I am doing maintenance on a legacy ASP.NET 3.5 and SQL Server web application. A particular feature is broken. Checking the log file reveals the following error:

Error: SqlException (262): Procedure: spMyStoredProcedure Line: 10 State: 20 Message: DISABLE TRIGGER permission denied in database 'MyDatabase'.

The stored procedure code is:

ALTER Procedure dbo.spMyStoredProcedure
as
    --Disable Triggers, no need to copy records into history tables
    Disable TRIGGER Trigger1 on myschema.table1;
    Disable TRIGGER Trigger2 on myschema.table2;
    Disable TRIGGER Trigger3 on myschema.table3;
    Disable TRIGGER Trigger4 on myschema.table4;

The user account being used for the database connection has been given the following roles:

SQL Server roles

How do I fix this?

Was it helpful?

Solution 2

The user account required access to myschema. Making the user an owner of myschema through Database User dialog box in SQL Server Management Studio resolved the error.

OTHER TIPS

To disable or enable trigger The user must have ALTER permission on the Table or the View on which trigger was defined/created.

To grant permission to the user on the table you can execute the following statement.

GRANT ALTER ON [dbo].[theTable] TO [User] 
GO
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top