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

前端 未结 14 2011
面向向阳花
面向向阳花 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!

    0 讨论(0)
  • 2020-12-05 13:27

    It could also be possible that you have created the "Products" in your login schema and you were trying to execute the same in a different schema (probably dbo)

    Steps to resolve this issue

    1)open the management studio 2) Locate the object in the explorer and identify the schema under which your object is? ( it is the text before your object name ). In the image below its the "dbo" and my object name is action status

    if you see it like "yourcompanydoamin\yourloginid" then you should you can modify the permission on that specific schema and not any other schema.

    you may refer to "Ownership and User-Schema Separation in SQL Server"

    0 讨论(0)
提交回复
热议问题