3

I am trying to create a simple table for error logging in one of my small databases. When I try to run CREATE TABLE, I get an error:

There is already an object named [thename] in the database

But there isn't. If you try to ALTER it, or DROP it, or anything else, it responds:

Cannot drop table [thename], because it does not exist...

Looking in Manager, the table does not exist. I looked in Views and all the other "folders" as well. I followed all the hints in this thread, including lots of F5's, rebooting, setting the options for the Designer, and I still have this problem.

UPDATE: for fun I simply tried a different table name - that failed the same way.

**UPDATE: **

CREATE TABLE PropBut_ERRORS 
(
    [HMY] [NUMERIC](18, 0) IDENTITY(1,1) NOT NULL,
    [sUser] [VARCHAR](255) NULL,
    [dtTimestamp] [DATETIME] NULL,
    [sPropCode] [VARCHAR](255) NOT NULL,
    [iBook] [INT] NOT NULL,
    [severity] [INT] NOT NULL,
    [message] [VARCHAR](255) NOT NULL
)

Any ideas?

0

2 Answers 2

1

Based on your comments plausible explanation - you do not have permission to see all objects.

Table you are trying to create already exists in database, but you do not see it.

When you try to create it, you got There is already an object named [thename] in the database

When you try to alter or drop, you got Cannot drop table [thename], because it does not exist... But notice the rest of this error: ...or you do not have permission.

5
  • But why would I have permission to see the same table when I simply give it a weird name? Sep 4, 2018 at 20:17
  • Because then it is a different (not existing in database) table.
    – Pm Duda
    Sep 4, 2018 at 20:18
  • You created it with your level of permission (probably in dbo schema). The other table might already exists and sysadmin prevents you from seeing it.
    – Pm Duda
    Sep 4, 2018 at 20:19
  • Oh yes, I see what you mean. But as the sysadmin, that seems remote. But in any event, deleting and recreating the db fixed it. Sep 4, 2018 at 20:23
  • 1
    Well, AFAIK if you are sysadmin then this is not the correct answer.
    – Pm Duda
    Sep 4, 2018 at 20:24
0

I deleted the US_Staging database, created it anew, and all my scripts ran fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.