• Try this on for size. It will give you the table name base on the object id in the where clause.

    SELECT *

    FROM sys.objects

    WHERE object_id = 632864

    GO

    --Here's the reverse - to get the Object Id of a known table name. "Department" is the name of the table

    SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].department')

    GO

    You can also use the following code to see if a table exist.

    -- this is also good if you need to check is a table exist in SQL

    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].department') AND type in (N'U'))

    print 'expression is False'

    ELSE

    PRINT 'expression is TRUE.' ;