Thursday, February 13, 2014

OPENQUERY() timeout error

Did you receive the following error while using an OPENQUERY() statement?

OLE DB provider “SQLNCLI1″ for linked server “[LinkedServerName]” returned message “Query timeout expired”.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider “SQLNCLI1″ for linked server “[LinkedServerName]” reported an error. Execution terminated by the provider because a resource limit was reached.
Msg 7320, Level 16, State 2, Line 1
Cannot execute the query ”

Try adding a TOP clause,  example:
SELECT TOP 250000 * .....
If the error still occurs , increase the timeout settings in the Server Properties window or Linked Server Properties window.