SQL Server Error "XML data type is not supported in distributed Queries" and workaround for it

Source: Internet
Author: User

Recently while working with data migration,got an error while running a following query where Server2 have beed added as Li nked server.

SELECT * from Server1.Database1.dbo.Table1 WHERE Column1 not in (SELECT Column1 from Server2.Database2.dbo.Table1) go--ERR or raised while run above query "XML data type was not supported in distributed queries. Remote object ' Server2.Database2.dbo.Table1 ' has XML column (s). "

Server2.Database2.dbo.Table1 objects has another column named ' Column2 ' had XML datatype and we have not used it anywhere In query. We used ' column1 ' of that table only and it have not XML datatype, even it has raised error. For the solution to avoid such error I had revised query as following.

 SELECT * from Server1.Database1.dbo.Table1 WHERE Column1 not in (SELECT * from OPENQUERY (Server2, ' SELECT Column1 from Database2.dbo.Table1 ') linked 


This is the information that is found on the Internet
According to this, I first convert the XML into nvarchar, and turn back to change into XML

SELECT Top [Internal database id],[internal database Search id],[watch list Code],[watch list Description], CONVERT (xml, CAST ([watch list record Detail] as nvarchar(max))) [Watch list record Detail] from OPEN QUERY( [172.16.4.169] ,
'SELECT top [Internal database ID], [Internal database Search id],[watch list Code],[watch list Description], CAST (Watch List Record Detail] as nvarchar (max)) [Watch List Record Detail] from [VERIDOCSECCM]. [dbo]. [Vml_view_watchlisthits]')

SQL Server Error "XML data type is not supported in distributed Queries" and workaround for it

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.