SQLTeam.com | Weblogs | Forums

Export xml to file


#1

checking thee xml file i exported arise the following error:
"Element type “P” must be followed by either attribute specifications, “>” or "/>"(checked by a xml editor)

here is the code i used:

IF OBJECT_ID('ClientInfo') IS NOT NULL
DROP TABLE ClientInfo;
GO

CREATE TABLE ClientInfo
(
ClientID INT PRIMARY KEY IDENTITY,
xml_data XML
);
INSERT INTO ClientInfo (xml_data)
VALUES
(
'<?xml version="1.0" encoding="UTF-8"?>


John
Doe


Jane
Doe

'
);
declare @xml_convert nvarchar(4000)
set @xml_convert='bcp "select xml_data from ClientDB.dbo.ClientInfo" queryout C:\Test\1.dat -S '+@@servername+' -T -w -t;'
EXEC master..xp_cmdshell @xml_convert

what is wrong?