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

Sql ServerSsms

Sql Server Problem Overview


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.

Sql Server Solutions


Solution 1 - Sql Server

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.

Solution 2 - Sql Server

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.

Solution 3 - Sql Server

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.

Solution 4 - Sql Server

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.

Solution 5 - Sql Server

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

Solution 6 - Sql Server

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

Solution 7 - Sql Server

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser247702View Question on Stackoverflow
Solution 1 - Sql Serveruser247702View Answer on Stackoverflow
Solution 2 - Sql ServerZohebView Answer on Stackoverflow
Solution 3 - Sql Serveruser3556018View Answer on Stackoverflow
Solution 4 - Sql ServerJafar MortazaviView Answer on Stackoverflow
Solution 5 - Sql ServerSruit A.SukView Answer on Stackoverflow
Solution 6 - Sql Serverst35lyView Answer on Stackoverflow
Solution 7 - Sql ServerNiranjan AView Answer on Stackoverflow