小编典典

SQL Server-包含FOR XML要求的无效XML标识符;

sql

我正在运行此查询,并出现以下提到的错误。有人可以帮忙吗?

列名“中间名”包含FOR XML要求的无效XML标识符;’‘(0x0020)是出现错误的第一个字符。

SELECT 
    Username as [LastName],
    '' AS [Middle Name],
    '' AS Birthdate,
    '' AS [SSN],
    0 AS [Wage Amount]
    FROM
    Employee
     FOR XML PATH

阅读 308

收藏
2021-05-23

共1个答案

小编典典

XML元素或属性名称中不能包含空格。使用

SELECT Username AS [LastName],
       ''       AS [MiddleName],
       ''       AS Birthdate,
       ''       AS [SSN],
       0        AS [WageAmount]
FROM   Employee
FOR XML PATH
2021-05-23