How to check (fast) if a federated table is connected?
-
29-10-2019 - |
Question
I have 5 federated tables. Each table is connected to another database. Now I do some stuff in a loop and the first thing I do in the loop is some stuff with the federated table. Because the database to which the federated table is linked is not always online I have a error handler which catches the error when the database is offline.
Unfortunately when the database is offline the query (a simple select query) takes about 5 seconds before it returns a error that the database is not online. If the database is then online I skip the rest of the code in the loop.
Now my problem is is that that routine needs to be executed every 5 seconds and needs to be finished in 5 seconds. However when the databases are offline to which the federated table is linked then it the failed attemps to connect to the database takes up: 5 db's * 5 sec = 25 seconds
So my question is it possible to check very fast in SQL if the database to which the federated table is linked to is online?
No correct solution