If you can post DDL for the table that has input data, that makes it easier for someone to respond. Shown below is an example where I created a table, but it has only couple of columns - you will need to expand the query in a similar manner for other nodes/attributesCREATE TABLE #tmp(EmployeeNumber INT, FirstName VARCHAR(32), Lastname VARCHAR(32));INSERT INTO #tmp VALUES (1,'a','b'),(2,'x','y');;WITH XMLNAMESPACES (DEFAULT 'http://epicor.com/EmployeeImport.xsd')SELECT EmployeeNumber AS [@EmployeeNumber], FirstName, LastNameFROM #tmp FOR XML PATH('Employee'), root ('EmployeeImportT')DROP TABLE #tmp;