Linked Servers

  • Folks,

    I am using linked servers to insert data into a database on another server. How do I know whether the linked server is available or not? If not, how to grab the error message?

    TIA

    Murali

  • The prblem is you may not know. SOmeone stated @@error could be used to trap and handle the error but I have not tried myself.

  • Simple way to test would be set one pointing to a copy of personal edition, then shut the pe down. Then access it and see what you get.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Simple way to test would be set one pointing to a copy of personal edition, then shut the pe down. Then access it and see what you get.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

    I tested that part also. I stopped the server on other end and try to insert data into that server. No error message. It won't continue executing the rest of the statements in the batch.

  • In cases where I need to guarantee the availability of a linked server, I query a system object on the linked server, and check for a known return. If it's not returned, server isn't available.

    May not be the best way, but it works reliably.

    Oh, I should have mentioned that this causes a delay while the server is queried. Its fine if it's there, but if it's not, the connection has to time out.

    Edited by - scorpion_66 on 12/06/2002 10:06:39 AM

  • It is better to check the target table availability before insert the record.

    Also have error handling to tell you weather or not the work is done.

    jiema


    Jie Ma

Viewing 6 posts - 1 through 5 (of 5 total)

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