How to check if a table exits on a different server
Posted on 2007-10-08
As a part of the stored procedure, I need to check from Server1, on which I the process will be scheduled to execute, if a given table exits on server2. Server 1 and Server 2 are linked. And to add to the complexity the table name I need to perform a lookup for is a variable.
I know, to find out if a given table exits on the same server, the syntax is this:
if exists (select * from information_schema where table_catalog = 'abc' and table_name = 'xyz')
But, I am not sure how to do the same, to check the table on a different server.
If there is no known way of doing this, is there anyway I can skip the error message. I do not wish to alarm the users.
Thanks in advance.