"列名 'Create Date' 包含无效的 XML 标识符,如 FOR XML 所需;' '(0x0020) 是第一个出错的字符。"





5.00/5 (2投票s)
解决 FOR XML PATH 子句中的无效字符
背景 我有一个存储过程,它将数据作为 XML 节点返回。该存储过程使用临时表来填充数据。临时表中的列名包含空格,例如 [Create Date]。错误
"Column name Create Date contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault."解决方案 在移除列名中的空格后,此错误已解决。