Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Deleting a Table....

Author  Topic 

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-01 : 15:01:39
Everytime I try to delete a table I get the following error:
Error 21776 The name 'web_resources' was not found in the (null) collection. If the name is a qualified name, use [] to separate various parts of the name, and try again.....

Anyone have any idea on this one? Is there a master stored proc. I can use to remove the table?

Thanks!

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-01 : 15:05:42
Select 'tables' from Enterprise Manager and hit refresh.

Jonathan
{0}
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-01 : 15:20:09
How and where are you trying to delete a table?



Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-01 : 15:27:23
Execute the below in Query Analyzer:

DROP TABLE web_resources


Tara
Go to Top of Page

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-01 : 17:42:50
Hmmm...None of them worked. I was trying to delete them in EM. It might have something to do with the fact that the table seems to have no owner.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-01 : 17:46:53
What error did you get in Query Analyzer?

All tables have owners. If it is not appearing correctly in Enterprise Manager, I would suggest running integrity checks:

DBCC CHECKDB(DBNameGoesHere)

Tara
Go to Top of Page

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-01 : 18:05:55
No errors when I ran the DB Check, but there are definitely no owners thru enterprise manager.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-01 : 18:20:32
But what error did you get in Query Analyzer when you ran DROP TABLE web_resources?

Tara
Go to Top of Page

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-01 : 20:05:20
Error Is:

Server: Msg 3701, Level 11, State 5, Line 1
Cannot drop the table 'web_resources', because it does not exist in the system catalog.

From what I can tell from the microsoft site, I need to somehow take ownership of the table, then I might be able to delete it.

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-07-02 : 02:59:47
quote:

Error Is:

Server: Msg 3701, Level 11, State 5, Line 1
Cannot drop the table 'web_resources', because it does not exist in the system catalog.

From what I can tell from the microsoft site, I need to somehow take ownership of the table, then I might be able to delete it.





That error message does not fit with that solution.

Who is the owner of the table at the moment?

Can you SELECT from the table?

Go into query analyzer and type

DROP TABLE [databasename].[tableowner].[tablename]

Does that work?

If you have SA rights on the box, table ownership matters should not prevent you from dropping the table.



-------
Moo.
Go to Top of Page

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-02 : 07:29:39
Nope, the delete doesn't work. Same error message. Anyone know what table in the master database has the info for the tables? I have sa rights, and it also won't let me select from the table. It is a mysterious phantom table.

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-07-02 : 07:36:05
Have you tried sp_changeobjectowner?

EXECUTE sp_changeobjectowner 'myTable', 'dbo'

If that doesn't work, I'd hate to suggest this, but you may have to go into sysobjects and update the uid column to match an existing user ID. This should be done AS A LAST RESORT ONLY:

UPDATE sysobjects SET uid=(SELECT Min(uid) FROM sysusers)
WHERE name='myTable'


Go to Top of Page

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-02 : 14:28:32
Updating the sysobjects did the trick. Thanks for all the help. That table was annoying the hell out of me, I was fixated on getting rid of it.



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-02 : 15:53:20
quote:

If that doesn't work, I'd hate to suggest this, but you may have to go into sysobjects and update the uid column to match an existing user ID. This should be done AS A LAST RESORT ONLY:

UPDATE sysobjects SET uid=(SELECT Min(uid) FROM sysusers)
WHERE name='myTable'




WOW...that is scary...didn't think you could play with the cat like that...can you mess with anything?

"Don't look at the light"....zaaaappppppp



Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-02 : 16:01:47
You can update the system tables, but you have to turn that option on. Can be done through sp_configure. It is highly recommended that you don't mess with the system tables. Of course, there are times when you need to like in this example. MS provides a set of system stored procedures that should be used instead of updating system tables. It's when there doesn't exist a system stored procedure that does what you need it to do is when you'll need to update system tables. I haven't had to update a system table in over a year and can't even remember why I had to do it.

Tara
Go to Top of Page
   

- Advertisement -