Table Id of table within a database

  • I know if I go into sysdatabase I can find the id to a database, but how do I find an id to a table within a database?

  • Take a look at OBJECT_ID() in BOL.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • select id from sysobjects where xtype = 'U'

    and you will find all the user tables.

    If the name is @name, the id of @name table will be the following:

     

    select id from sysobjects where name = @name

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply