0

Select * from openQuery(XYZ,'abc');

The query executes correctly if the linked server is available. I want to display zero if the linked server is down. Is there any way I can do this.

shiny p
  • 3
  • 4

1 Answers1

0

You can use a try / catch statement. Explained here.

phadaphunk
  • 12,785
  • 15
  • 73
  • 107
  • I tried it and it gives the same error if connection is lost. – shiny p Dec 14 '12 at 19:32
  • Try catch along with the function to check the linked server helped me . The function to check the linked server connection is available in the link below http://stackoverflow.com/questions/3104186/sql-server-is-there-an-if-exists-test-for-a-linked-server – shiny p Dec 14 '12 at 20:16