hunchback (11/12/2013)
Have the descriptor in a separated file and do the concatenation at the command side using COPY.c:\>copy f1 /B + f2 /B f3 /B
Why would someone use the file system just to add a separate row?
If the output is finally stored in a file, why not using the VARCHAR() data type inside SQL Server?
If the output is used by a different application, then this app should "convert" the output to xml (which is an implicit conversion).
There's just not enough information provided so far why it has to be XML format within SQL Server...
Btw: If you add the encoding outside SQL Server and re-import the file into an xml variable, the encoding is gone again...