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

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!


Are you sure that you are executing the script against the correct database? In SQL Server Management studio you can change the database you are running the query against in a drop-down box on one of the toolbars, or you can start your query with this:

USE SomeDatabase

It can also happen due to a typo in referencing a table such as [dbo.Product] instead of [dbo].[Product].

Tags:

Sql Server