How can I resolve the “Table 'dbo.Foo' already exists.” error when the table does not exist?

安稳与你 提交于 2019-12-18 18:37:13

问题


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.

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

Table 'dbo.Foo' already exists.

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.

Refreshing the IntelliSense cache does not help.


回答1:


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.




回答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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


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




回答7:


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.



来源:https://stackoverflow.com/questions/19702699/how-can-i-resolve-the-table-dbo-foo-already-exists-error-when-the-table-doe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!