Object_Id

  • pattikay

    Old Hand

    Points: 349

    How do you get the object_id of a table or any objeect on another server dynamically ?

    I have tried :

    select object_id("@servername.@dbname.dbo.attendance_details")

    It returns NULL.

    When i try to get the id without the use of variables ie.

    select object_id("servername.dbname.dbo.attendance_details")

    The query still returns NULL.

    I am executing it in a query in a stored procedure in the following way :

    select "Database Version"= syp_value, "Total Attendances" = rows

    FROM servername.database.owner.systemproperties, servername.database.owner.sysindexes

    where id = OBJECT_ID("servername.database.owner.Attendance_details")

    AND indid < 2

    AND syp_type = "Database Version"

    Thanks in advance.

    Edited by - pattikay on 08/02/2001 04:33:40 AM

  • Chris Hedgate

    One Orange Chip

    Points: 25041

    Embed the OBJECT_ID() function in a stored procedure on the remote server, and execute the proc with the name of the object you want the id for.

    Chris Hedgate @ Apptus Technologies (http://www.apptus.se)

  • pattikay

    Old Hand

    Points: 349

    Thanks .that's a very good idea.I will try it out.

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

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