Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Creating Table: "There is already an object named 'table' in the database", but I have no constraint with that name

Tags:

sql

sql-server

Error occur in MS SQL Server

Error Creating Table: "There is already an object named 'table' in the database", but I have no table and not any constraint with the same name in database.

I have to inform you that this happened after performing a rename on a table and then a creation of a table named with the old table name.

Example:

sp_rename OldTable, NewTable
Create Table [OLDTable] ([id] [int] Identity(1,1) NOT NULL)

And then it gives me the error

If someone knows the answer, I've been searching for hours and I would be glad to solve this problem.

like image 575
MadDestructor Avatar asked Jan 28 '26 18:01

MadDestructor


1 Answers

Try SELECT * FROM sys.objects WHERE name LIKE '%yout_table_name%' to see all existing system objects with given name.

like image 135
Lunik Avatar answered Jan 30 '26 10:01

Lunik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!