SQL Server - contains an invalid XML identifier as required by FOR XML;
11,789
You can't have spaces in XML element or attribute names. Use
SELECT Username AS [LastName],
'' AS [MiddleName],
'' AS Birthdate,
'' AS [SSN],
0 AS [WageAmount]
FROM Employee
FOR XML PATH
Author by
Conrad Jagger
Updated on June 21, 2022Comments
-
Conrad Jagger almost 2 years
I'm running this query and getting below mentioned error. Can anyone help?
Column name 'Middle Name' contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault.
SELECT Username as [LastName], '' AS [Middle Name], '' AS Birthdate, '' AS [SSN], 0 AS [Wage Amount] FROM Employee FOR XML PATH
-
enigma6205 about 6 yearsAwesome tip! Thanks Martin.