Hi,
I have a table containing rows of XML data stored in the SQL XML Data type. I'd like to export the complete XML in each row to one concatenated XML file, then add some final body tags around the lot - is this possible using T-SQL?
I have used bcp to successfully do this for one row to one XML file, but when trying multiple rows to one XML file the charcters aren't readable. This is what I have used so far:
declare @cmd nvarchar(255);
select @cmd = '
bcp "SELECT TOP 10 XMLColumn from DB1.[dbo].[XMLFiles] " ' +
'queryout "C:\sample.xml" -S myserver -T -w -r -t';
exec xp_cmdshell @cmd;
go
Can anyone help?