- Error number
- 2714
- Severity
- 16 (user-correctable error)
- State
- 6 (see the state table below)
- Product
- Microsoft SQL Server Database Engine
- Versions
- All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
- Category
- Syntax & Object Resolution
- Last reviewed
- 23 October 2026
On this page
What it means
Error 2714 means a CREATE statement (or SELECT INTO) tried to create an object whose name is already taken in that schema, by a table, view, procedure, function or constraint.
Within a schema, tables, views, procedures, functions, triggers and constraints share one namespace (sys.objects). A CREATE TABLE, CREATE VIEW, CREATE PROCEDURE or SELECT INTO that names an object already present in that schema fails with 2714 at severity 16, and nothing is created. The name in quotes is the clashing name, without its schema.
Two details catch people out. Constraint names live in the same namespace, so a primary key called PK_Orders on one table blocks a second PK_Orders on another table, and the CREATE TABLE fails with 2714 followed by 1750. Temporary tables belong to your session, so re-running a script that creates #Totals in the same SSMS window fails until the first one is dropped or the session ends. The state differs by statement in our reproductions (see below), but the fix is decided by what already owns the name.
| State | Meaning |
|---|---|
| 1 | Observed when one batch contains two CREATE TABLE statements for the same temporary table. |
| 3 | Observed for CREATE PROCEDURE and CREATE VIEW (the message also shows the module name). |
| 5 | Observed when a constraint name (primary key, unique, foreign key) is already in use. |
| 6 | Observed for CREATE TABLE and SELECT INTO, for permanent and temporary tables. |
Common causes
- A deployment or setup script run a second time without an existence check.
- A constraint name copied from another table, such as PK_Orders reused on an archive table.
- A script that creates a #temp table run again in the same session.
- SELECT INTO a backup or staging table that a previous run already created.
- CREATE VIEW or CREATE PROCEDURE used to change an existing module instead of ALTER or CREATE OR ALTER.
- A new object whose name matches an object of a different type, for example a view with the same name as a table.
Diagnose it
Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.
Find what owns the name
Look the name up in sys.objects. For a constraint, the parent table shows where the name is already used.
SELECT SCHEMA_NAME(o.schema_id) AS schema_name, o.name, o.type_desc,
OBJECT_NAME(o.parent_object_id) AS parent_table, o.create_date
FROM sys.objects AS o
WHERE o.name = N'PK_Orders'; The existing object, its type (USER_TABLE, VIEW, SQL_STORED_PROCEDURE, PRIMARY_KEY_CONSTRAINT...) and, for constraints, the table it belongs to.
Check whether your session already has the temp table
SELECT OBJECT_ID(N'tempdb..#Totals') AS temp_table_id; A number means this session still holds #Totals from an earlier run; NULL means it does not exist.
How to fix it
Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.
Create the object only if it does not exist
Changes schemaMake setup scripts safe to re-run by checking first. The second argument of OBJECT_ID restricts the check to a type (U is a user table).
IF OBJECT_ID(N'dbo.Products', N'U') IS NULL
CREATE TABLE dbo.Products (id INT PRIMARY KEY, name NVARCHAR(100));
Use CREATE OR ALTER for views, procedures and functions
Changes schemaCREATE OR ALTER replaces the definition when the module exists and keeps its permissions, instead of failing with 2714.
CREATE OR ALTER PROCEDURE dbo.usp_GetOrders
AS
SELECT id, total FROM dbo.Orders;
Give constraints names that include the table
Changes schemaName each constraint after its own table (PK_OrdersArchive), or omit the name and let SQL Server generate a unique one.
CREATE TABLE dbo.OrdersArchive (
id INT CONSTRAINT PK_OrdersArchive PRIMARY KEY,
total DECIMAL(10,2)
);
Drop a leftover temp table before recreating it
Changes schemaFor #temp tables in scripts you re-run, drop the session's copy first. Only do this for objects your script owns.
Caution: Never add DROP TABLE IF EXISTS in front of a permanent table to make a script re-runnable: it deletes the table and its data. Use an existence check instead.
DROP TABLE IF EXISTS #Totals;
CREATE TABLE #Totals (id INT, total DECIMAL(10,2));
Examples
A CREATE TABLE script run twice
CREATE TABLE dbo.Products (id INT PRIMARY KEY, name NVARCHAR(100));
CREATE TABLE dbo.Products (id INT PRIMARY KEY, name NVARCHAR(100), price DECIMAL(10,2));
Msg 2714, Level 16, State 6, Line 3 There is already an object named 'Products' in the database.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
A constraint name copied from another table
CREATE TABLE dbo.Orders (id INT CONSTRAINT PK_Orders PRIMARY KEY, total DECIMAL(10,2));
CREATE TABLE dbo.OrdersArchive (
id INT CONSTRAINT PK_Orders PRIMARY KEY, -- name copied from dbo.Orders
total DECIMAL(10,2)
);
Msg 2714, Level 16, State 5, Line 3 There is already an object named 'PK_Orders' in the database. Msg 1750, Level 16, State 1, Line 3 Could not create constraint or index. See previous errors.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
A temp table script run again in the same session
CREATE TABLE dbo.Orders (id INT PRIMARY KEY, total DECIMAL(10,2));
CREATE TABLE #Totals (id INT, total DECIMAL(10,2));
GO
CREATE TABLE #Totals (id INT, total DECIMAL(10,2)); -- script run again in the same session
Msg 2714, Level 16, State 6, Line 2 There is already an object named '#Totals' in the database.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
How to prevent it
Write deployment scripts to be idempotent: guard CREATE TABLE with an existence check, and use CREATE OR ALTER for views, procedures, functions and triggers. Name constraints with a convention that includes the table (PK_Table, FK_Child_Parent, UQ_Table_Column) so names cannot collide.
For temp tables in scripts you run repeatedly, start with DROP TABLE IF EXISTS #name, or use a table variable whose lifetime ends with the batch. The DDL commands lesson covers CREATE, ALTER and DROP.
Common questions
Why does it say the object exists when I cannot see a table with that name?
The name may belong to a constraint, view, procedure or function, all of which share the namespace with tables. Query sys.objects by name to see what owns it.
Can two schemas have objects with the same name?
Yes. dbo.Orders and Billing.Orders can coexist. Error 2714 only fires within one schema, so check which default schema an unqualified CREATE used.
How do I fix 2714 for a #temp table in SSMS?
The table survives until your session ends or you drop it. Run DROP TABLE IF EXISTS #name before the CREATE, or open a new query window.
Learn more on CodeWithSQL
Official documentation
- CREATE TABLE (Transact-SQL)
- sys.objects (Transact-SQL)
- CREATE PROCEDURE (Transact-SQL)
- Database engine events and errors (2000 to 2999)
Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.