need a list of tables on a linked server

  • Hi everyone,

    I am trying to see if a table exists on a linked server, I have tried using the INFORMATION_SCHEMA.TABLES view but the path needs to be fully qualified (FQP) and therefore I can only get the master DB's tables. I have also tried using the FQP with the OBJECT_ID() function but had no success there either. IF EXISTS (SELECT * FROM FQP )works fine if you have rows in the table, however this will not always be the case.

    I know I can go to the root of the INF_SCHEMA.TABLES view and use the sysobjects table but I am really not happy with this solution as this code is for use in a COTS product.

    Any ideas folks?

  • Take a look at

    sp_tables_ex

    in SQL BOL.

  • Thanks, that does the job nicely.

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

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