PRB: OpenQuery Function Fails with Queries That Exceed 8000 Characters (286370)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
- Microsoft SQL Server 6.5
- Microsoft SQL Server 7.0
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
This article was previously published under Q286370 SYMPTOMS
When you try to execute an extremely long query text (greater than 8000 characters) inside of an OPENQUERY function, with a linked server, you may see error messages similar to:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near <...SQL...>
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with <...SQL...>
In the preceding error messages, <...SQL...> vary based on the query text that you pass to the OPENQUERY function.
CAUSE
You are passing more than 8000 characters for the second parameter of the OPENQUERY function.
RESOLUTION
The second parameter (which is the query you want to execute on the remote linked server) of the OPENQUERY function can only accept 8000 characters.
To resolve this problem you must modify your query to fit into the 8000 character limit.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/5/2003 |
---|
Keywords: | kbDatabase kbprb KB286370 |
---|
|