Xml data type is not supported in distributed queries

The error is:

Msg 9514, Level 16, State 1, Line 216
Xml data type is not supported in distributed queries. Remote object [Server_name].[DB_Name].dbo.[table_name]’ has xml column(s).

Are you trying to query a remote DB\table which contains an xml column? That is the reason behind this error.

Can this be done? Yes; you will have to have to use OpenQuery and Cast the xml column as nvarchar(max).

See Example below:

  1. Select * from OpenQuery(ServerName, ‘Select Col1, Col2, Col3, Cast(Col4 as NVarchar(max)) from [DB_Name].[Schema_Name].[Table_Name]’)
    • How Big can NVarchar(max) Be? 2 GB (More Info)
  2. Resources
    1. (Open Query Info)

Be the first to comment

Leave a Reply

Your email address will not be published.


*