创建表时出错:"There is already an object named 'table' in the database",但我对该名称没有约束



错误发生在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.

我必须通知您,这是在对一个表执行重命名,然后用旧表名创建一个表之后发生的。

示例:

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

然后它给了我错误

如果有人知道答案,我已经找了几个小时了,我很乐意解决这个问题。

尝试SELECT * FROM sys.objects WHERE name LIKE '%yout_table_name%'查看具有给定名称的所有现有系统对象。

在创建表之前,请尝试运行下面的代码。你可能会很幸运。

DROP TABLE <tablename>

当然,你永远不会真正知道发生了什么。。。

相关内容

最新更新