• 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

  • 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)

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

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

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