Deborah Melkin handles missing servers with aplomb:
OPENROWSET is a functionality that allows you to access data sources outside your current server. This could be reading from an Excel file or calling another SQL Server instance. You’re able to treat that other data source as record set, or derived table, and work with the rows returned as you would a local table. One reason you may want to do this is that you need to use a stored procedures to query data from other servers and bring the data together, effectively creating an ELT (Extract – Load – Transform) process without having to use SSIS or Azure Data Factory (ADF).
Read on to see how OPENROWSET()
works, what happens if you try to access a remote server which doesn’t exist (or times out), and how you can capture that error message in a CATCH
block—something that is not possible to do by default.