SQL Server error 3701: Cannot drop, object not found
A DROP named an object that doesn't exist in the current database, or that you don't have permission to see. Use DROP ... IF EXISTS in scripts.
- Error number
3701- Severity
- 11
- Category
- Names and objects
What it means
SQL Server raises 3701 when DROP TABLE, DROP VIEW, DROP PROCEDURE and similar statements can't find the object. It deliberately doesn't say whether the object is missing or hidden from you by permissions. The severity is 11, so the batch continues after it.
Common causes
- The object was already dropped, or never created in this environment.
- Running in the wrong database or without the schema prefix.
- Lacking permission to see the object, which makes it look absent.
How to fix it
-
Use the
IF EXISTSform so scripts can be run repeatedly.DROP TABLE IF EXISTS dbo.Staging; DROP PROCEDURE IF EXISTS dbo.LoadStaging;
-
On versions before SQL Server 2016, guard with
OBJECT_ID.IF OBJECT_ID(N'dbo.Staging', N'U') IS NOT NULL DROP TABLE dbo.Staging; -
Check the current database and the schema-qualified name.
Related errors
208Invalid object name15151Object doesn't exist or no permission3726Can't drop: referenced by a FOREIGN KEY42P01PostgreSQL: relation does not exist1051MySQL: Unknown table
More names and objects errors
207Invalid column name4104Multi-part identifier not bound209Ambiguous column name2812Could not find stored procedure2714There is already an object named3702Cannot drop database, currently in use5030Database couldn't be exclusively locked8144Too many arguments specified
The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.
Work on SQL Server in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.