I noticed the error…

There is no user table matching the input name ‘%’ in the current database or you do not have permission to access the table

Cannot find the object “%” because it does not exist or you do not have permissions.

today while querying sys.sysobjects directly; I see a few blog posts on the error, and most read that they found it or something similar to while running sys.sp_indexoption. It looks like maybe a table existed and has been dropped, but any cleanup process hasn’t run, so the object is still in the system tables. I’ve noticed this before but never really thought about it; when running my compression script today, it errors out while trying to find the table. 

No harm done when I got the error in my script, so I decided to go ahead and query INFORMATION_SCHEMA.TABLES, right, which is really the correct way to do it or so we’ve been told for 10 years.  Worked great?  Um, no. The same table name that’s a ‘ghost’ (for no better word) record in sys.sysobjects is sitting there as well. Makes sense to me – INFORMATION_SCHEMA gets its data from the same place, so when it is in one, apparently it will be the other.

Thanks,
Lee

 

---------------------------

Hey, baby, what's happening? How are ya doing? Once you have a man with no legs, you never go back, baby. I know what you're thinkin'. You seen "Porgy and Bess"? [the woman begins to walk away]
We can make it, baby! Me and you!... BITCH!


Posted in: TSQL  Tags:
blog comments powered by Disqus

by Lee Everest, M.S.

Info

Poll

Do you use Azure or cloud in your organization?



Show Results

Ads

Search


Month List

Calendar

«  May 2012  »
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
View posts in large calendar

Tags

Disclaimer
The opinions, code, examples, et.al. expressed herein are my own personal opinions and do not represent my employer's view in any way, shape form, or fashion.  All code for demonstration purposes - no guarantees, either written or implied, are made.

© Copyright 2012 Lee Everest's SQL Server, etc. weblog