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
 SQL Server 2012 Forums
 Other SQL Server 2012 Topics
 Find Table in All Databases

Author  Topic 

Dhudson29
Starting Member

23 Posts

Posted - 2014-09-19 : 14:46:15
I am running the following query to find where a specific table is located. I'm doing this because I'm getting an error on a job that tells me there are invalid rows in a table called sys.syssingleobjrefs. I have no idea where this table is located, so I'm running:

EXECUTE master.sys.sp_MSforeachdb 'use ?; select ''?'' dbname, name from sys.tables where name like ''%syssingleobjrefs%'''

The query keeps erroring out with the following message:
Msg 911, Level 16, State 1, Line 1
Database 'SharePoint_AdminContent_c47fe0a2' does not exist. Make sure that the name is entered correctly.

However, that database does exist. Any ideas??

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-09-19 : 15:27:17
It exists in every database according to this article: http://msdn.microsoft.com/en-us/library/ms179503.aspx

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -