FOR XML 无法序列化节点的数据,因为它包含一个字符 (0x000E)

unh*_*wed 5 xml sql t-sql reporting-services ssrs-2008

我试图在 SSRS 中使用 FOR XML,但是当报告运行时,它有时会给我这个错误:

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.
Run Code Online (Sandbox Code Playgroud)

我正在使用 FOR XML 将一个注释列连接到 SSRS 中的一个单元格中。由于一个用户可以存在多个评论,这将解决重复的问题。有谁知道为什么我会在 SSRS 中收到此错误?

Pro*_*ega 6

它似乎是一个看起来像音符的特殊字符。您可以像这样找到导致问题的行:

SELECT Notes FROM MyTable WHERE Notes like '%' + char(0x000E) + '%'
Run Code Online (Sandbox Code Playgroud)

您可以通过删除有问题的字符来解决问题。

 UPDATE MyTable SET Notes = REPLACE(Notes, char(0x000E) , '') 
 WHERE Notes like '%' + char(0x000E) + '%'
Run Code Online (Sandbox Code Playgroud)

  • 这种方法效果很好。知道是否有办法搜索一整套这些类型的特殊字符吗?我不断在我的数据中找到更多。 (4认同)