A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
How is it possible for an OPENQUERY to time out?
By default when you run a query against a linked server, SQL Server has a timeout of ten minutes. It does not matter if you are using four-part notation, OPENQUERY, EXEC AT or execute a remote stored procedure.
So if your query against the remote data source takes more than ten minutes, you will get the timeout error.
As for why the query runs for ten minutes, there can be many reasons:
- Lots of data to chug through.
- Bad query plan.
- Blocking.
- Network issues.
The latter may be applicable in your case, if the remote database is in the cloud, and the local server is on-prem. But it could also be any of the other issues.