PRB: Use of FULL OUTER JOIN with TEXT Column Through a Linked Server Returns Error Message 8626 (269426)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
- Microsoft SQL Server 7.0
This article was previously published under Q269426 SYMPTOMS
When all of the following conditions are met:
- A remote table is being joined with a FULL OUTER JOIN.
- The remote table has a TEXT column.
- The TEXT column is referenced in the select list.
the following error message occurs:
Server: Msg 8626, Level 16, State 1, Line 1
Only text pointers are allowed in work tables, never text, ntext, or
image columns. The query processor produced a query plan that required
a text, ntext, or image column in a work table.
CAUSE
This behavior is by design because FULL OUTER JOINs do not allow you to access a TEXT column through a linked server.
WORKAROUND
Use a UNION ALL statement with a LEFT OUTER JOIN and RIGHT OUTER JOIN. The following example may be helpful:
SELECT * FROM s LEFT OUTER JOIN linked_server1.pubs.dbo.t as t on s.i= t.i
UNION ALL
SELECT * FROM s RIGHT OUTER JOIN linked_server1.pubs.dbo.t as t on s.i= t.i
If you want to eliminate duplicate rows, use a combination of LEFT and RIGHT OUTER JOINs with a UNION statement and you can use the system defined function SUBSTRING. For example:
SELECT s.i, s.j, SUBSTRING(s.t, 1,200), t.i, t.j, SUBSTRING(t.t, 1, 200) FROM s LEFT OUTER JOIN linked_server1.pubs.dbo.t as t on s.i= t.i
UNION
SELECT s.i, s.j, SUBSTRING(s.t, 1,200), t.i, t.j, SUBSTRING(t.t, 1, 200) FROM s RIGHT OUTER JOIN linked_server1.pubs.dbo.t as t on s.i= t.i
For information about how the tables and linked servers in the preceding queries are set up, refer to the "More Information" section of this article.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbprb KB269426 |
---|
|