Cannot find the object because it does not exist or you do not have permissions. Error in SQL Server

前端 未结 14 2103
面向向阳花
面向向阳花 2020-12-05 12:35

I have a database and have a Sql script to add some fields to a table called \"Products\" in the database.

But when i am executing this script, I am getting the foll

14条回答
  •  误落风尘
    2020-12-05 13:27

    I found a reason why this would happen. The user had the appropriate permissions, but the stored procedure included a TRUNCATE statement:

    TRUNCATE TableName
    

    Since TRUNCATE deletes items without logging, you (apparently) need elevated permissions to execute a stored procedure that contains it. We changed the statement to:

    DELETE FROM TableName
    

    ...and the error went away!

提交回复
热议问题