Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

How to get the table name from a objectID? Expand / Collapse
Author
Message
Posted Monday, July 15, 2013 4:32 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 5, 2014 2:13 AM
Points: 25, Visits: 105
Hi

I am trying to find the name of a table in our database given a objectID, when i run this

select *
from sysobjects
where id = 632864

I get no records returned. any ideas?

I have got the objectID from

Table error: Object ID 632864, index ID 17051, page ID (1:28510200). The PageId in the page header = (55702:800)

Thanks
Post #1473558
Posted Monday, July 15, 2013 4:47 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:32 AM
Points: 5,369, Visits: 9,922
The object ID is only unique within each database. Are you sure you're querying the correct database? By the way, sysobjects is only included for backward compatibility. You should use sys.objects instead.

John
Post #1473566
Posted Monday, July 15, 2013 4:57 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:25 PM
Points: 39,910, Visits: 36,250
You've got database corruption.

The table name will be printed as part of the CheckDB output. Please run the following and post the full and complete output.
DBCC CHECKDB (<Database Name>) WITH NO_INFOMSGS, ALL_ERRORMSGS




Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1473572
Posted Monday, July 15, 2013 4:59 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:31 PM
Points: 5,867, Visits: 12,951
select OBJECT_NAME(632864)

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

Post #1473573
Posted Monday, July 15, 2013 5:08 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 5, 2014 2:13 AM
Points: 25, Visits: 105
george sibbald (7/15/2013)
select OBJECT_NAME(632864)


Sorry that did not work, it came back with NULL
Post #1473579
Posted Monday, July 15, 2013 5:09 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 5, 2014 2:13 AM
Points: 25, Visits: 105
GilaMonster (7/15/2013)
You've got database corruption.

The table name will be printed as part of the CheckDB output. Please run the following and post the full and complete output.
DBCC CHECKDB (<Database Name>) WITH NO_INFOMSGS, ALL_ERRORMSGS



Sorry i forgot to mention i am using SQL 2000. so sys.objects is not valid. Yes i am querying the correct DB
Post #1473580
Posted Monday, July 15, 2013 5:11 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:25 PM
Points: 39,910, Visits: 36,250
2000 questions should go in the SQL 2000 forums.

You have database corruption, so that object id is very likely invalid, especially given the nonsensical index id listed (max index id is 255)



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1473582
Posted Monday, July 15, 2013 5:28 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 5, 2014 2:13 AM
Points: 25, Visits: 105
GilaMonster (7/15/2013)
2000 questions should go in the SQL 2000 forums.

You have database corruption, so that object id is very likely invalid, especially given the nonsensical index id listed (max index id is 255)


Im sorry for posting in the incorrect forum

I am aware i have database corruption, i am trying to script all the objects that are good and leave all the corrupted tables (i am aware that i will lose data). So i was trying to find out where this corrupted table is.

That line i posted above is from the CHECKDB i ran earlier, i will post the complete output in a moment
Post #1473591
Posted Monday, July 15, 2013 5:29 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:31 PM
Points: 5,867, Visits: 12,951
imran.adam (7/15/2013)
george sibbald (7/15/2013)
select OBJECT_NAME(632864)


Sorry that did not work, it came back with NULL


it would work for a valid id. Just wanted to show you a quick way to resolve it. It proves that that object_id is not valid in your database. run checkdb as gail suggests


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

Post #1473592
Posted Monday, July 15, 2013 5:34 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:31 PM
Points: 5,867, Visits: 12,951
check also the minimum repair level checkdb reports.

If its a non-clustered index that turns out to be corrupted you may be able to just drop and recreate it.

Do you have a clean backup? almost always your best way out of a corruption.


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

Post #1473595
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse