FOR XML could not serialize the data for node because it contains a character (0x000E)

佐手、 提交于 2019-12-11 03:08:56

问题


I am trying to use FOR XML in SSRS, but when the report runs it sometimes gives me this error:

FOR XML could not serialize the data for node 'NoName' because it contains a character (0x000E) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.

I'm using FOR XML to concatenate a comments column into one cell within SSRS. Since multiple comments can exist for one user, this would solve the issue with duplicates. Does anyone have an idea why I would get this error in SSRS?


回答1:


It appears to be a special character that looks like a musical note. You can find the row that is causing your problem like this:

SELECT Notes FROM MyTable WHERE Notes like '%' + char(0x000E) + '%'

You can fix the problem by removing the offending character.

 UPDATE MyTable SET Notes = REPLACE(Notes, char(0x000E) , '') 
 WHERE Notes like '%' + char(0x000E) + '%'


来源:https://stackoverflow.com/questions/26279715/for-xml-could-not-serialize-the-data-for-node-because-it-contains-a-character-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!