I am creating an XML document from a SQL query and i was wondering if there is a way to output the version and encoding tag via the SQL Query?
                
                A: 
                
                
              
            I think you can manually prepend this information to the query result as they are no more than two strings.
                  GSerg
                   2009-03-30 00:24:16
                
              
                
                A: 
                
                
              
            The FOR XML was new in SQL Server 2005, right? So you'd have to manually assemble the XML:
select 
   '<?xml version="1.0" encoding="ISO-8859-1" ?>' + char(13) + char(10) +
   '<root>' + char(13) + char(10) +
   '    <value>' + yourtable.yourfield + '</value>' + char(13) + char(10) +
   '</root>' + char(13) + char(10)
from yourtable
where id = 1
It's up to you to transmit it in the encoding you claim in the XML header.
                  Andomar
                   2009-03-30 09:51:42