如何解析“表”dbo。Foo”已经存在。“表不存在时出错吗?”

时间:2020-12-21 18:04:39

I've created a table and then realised I made a mistake. SSMS wouldn't let me update the table without recreating it, so I've deleted the table and then tried to create it again.

我做了一张桌子,然后意识到我犯了一个错误。SSMS不允许我在不重新创建表的情况下更新表,所以我删除了表,然后再尝试创建它。

It won't let me do this, and I get an error dialog

它不会让我这么做,我得到一个错误对话框

Table 'dbo.Foo' already exists.

dbo表”。Foo”已经存在。

So I try to delete it again:

所以我尝试再次删除它:

drop table dbo.Foo

Cannot drop the table 'dbo.Foo', because it does not exist or you do not have permission.

不能删除表的dbo。因为它不存在或者你没有权限。

Refreshing the IntelliSense cache does not help.

刷新智能感知缓存没有帮助。

7 个解决方案

#1


77  

Closing and restarting SSMS seems to be the only way to get rid of the error. After doing so, I can again successfully create the table.

关闭和重新启动SSMS似乎是消除错误的唯一方法。这样做之后,我可以再次成功地创建表。

#2


6  

I was having the same problem. Right-click on your server connection and select 'Refresh'. I did this and was able to save the recreated table without restarting SSMS.

我也有同样的问题。右键单击服务器连接并选择“Refresh”。我这样做了,并且能够在不重新启动SSMS的情况下保存重新创建的表。

#3


5  

To change this, on the Tools menu, click Options, expand Designers, and then click Table and Database Designers. Select or clear the Prevent saving changes that require the table to be re-created check box.

要更改这一点,请在“工具”菜单上单击“选项”、“展开设计器”,然后单击“表和数据库设计器”。选择或清除需要重新创建表的阻止保存更改复选框。

#4


4  

I found that you just need to close all the 'delete's table' TAB from SSMS and it's done

我发现你只需要从SSMS中关闭所有的“delete's table”选项卡就可以了

#5


2  

Create the Table with any other name and then rename it works fine. Server refresh did not work for me. You can try to restart Management Studios though.

用任何其他名称创建表,然后重命名它工作正常。服务器刷新对我不起作用。您可以尝试重新启动管理工作室。

#6


1  

Make sure that you have no non-saved table changes (better to close all tabulators and try it again)

确保没有未保存的表更改(最好关闭所有表符并再次尝试)

#7


0  

Right-click on the Server, click on Refresh and try again! Worked like a charm for me. Hope the same works for you as well.

右键单击服务器,单击Refresh并再次尝试!对我来说,工作很有魅力。希望对你也一样。

#1


77  

Closing and restarting SSMS seems to be the only way to get rid of the error. After doing so, I can again successfully create the table.

关闭和重新启动SSMS似乎是消除错误的唯一方法。这样做之后,我可以再次成功地创建表。

#2


6  

I was having the same problem. Right-click on your server connection and select 'Refresh'. I did this and was able to save the recreated table without restarting SSMS.

我也有同样的问题。右键单击服务器连接并选择“Refresh”。我这样做了,并且能够在不重新启动SSMS的情况下保存重新创建的表。

#3


5  

To change this, on the Tools menu, click Options, expand Designers, and then click Table and Database Designers. Select or clear the Prevent saving changes that require the table to be re-created check box.

要更改这一点,请在“工具”菜单上单击“选项”、“展开设计器”,然后单击“表和数据库设计器”。选择或清除需要重新创建表的阻止保存更改复选框。

#4


4  

I found that you just need to close all the 'delete's table' TAB from SSMS and it's done

我发现你只需要从SSMS中关闭所有的“delete's table”选项卡就可以了

#5


2  

Create the Table with any other name and then rename it works fine. Server refresh did not work for me. You can try to restart Management Studios though.

用任何其他名称创建表,然后重命名它工作正常。服务器刷新对我不起作用。您可以尝试重新启动管理工作室。

#6


1  

Make sure that you have no non-saved table changes (better to close all tabulators and try it again)

确保没有未保存的表更改(最好关闭所有表符并再次尝试)

#7


0  

Right-click on the Server, click on Refresh and try again! Worked like a charm for me. Hope the same works for you as well.

右键单击服务器,单击Refresh并再次尝试!对我来说,工作很有魅力。希望对你也一样。