Appending Text to FOR XML SQL Select Statement
I have three `Select` statements I want to join:  

Select 2 is a `FOR XML` Select to which I want to append Selects 1 & 3 (which simply display some text) as a kind of header/footer.  

All three Selects work as intended and form three parts of a nicely-formed podcast .xml, but I need them to end up in one result so I can eventually save it to an .xml file (which will be my next headache, I suppose).  

I have tried permutations of `+`, `UNION`, and `JOIN` that my inexperienced mind can come up with, but to no avail. 

**Select #1 (simply some text)**  

    Select  '<?xml version=''1.0''?>
    <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
        <channel>
          <atom:link href="http://www.borntowin.net/podcast/borntowin.xml" rel="self" type="application/rss+xml" />
      <itunes:image href="http://www.borntowin.net/Portals/0/Images/Audio/podcast_logo.jpg"/>
      <link>http://www.borntowin.net/Audio.aspx</link>
    <title>Born to Win Podcast</title>
    <description>Born to Win''s Daily Radio Broadcast and Weekly Sermon</description>
    <language>en-us</language>
    <copyright>&#xA9; 2010</copyright>
          <itunes:subtitle>Making Life Work</itunes:subtitle>
          <itunes:owner>
            <itunes:name>Christian Educational Ministries</itunes:name>
            <itunes:email>webmaster@borntowin.net</itunes:email>
          </itunes:owner>
          <itunes:category text="Religion &amp; Spirituality">
            <itunes:category text="Christianity" />
          </itunes:category>
          <itunes:explicit>No</itunes:explicit>
          <ttl> 120 </ttl>'   

**Select #2 (my data)**  

    Select 
    (Select Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 305 and UserDefinedRowId = item.UserDefinedRowId) as [title]
    ,(Select 'Today''s Program is ' + Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 305 and UserDefinedRowId = item.UserDefinedRowId) as [description]  
    ,(Select Cast(Cast(FieldValue as nvarchar(max)) as DateTime) from dbo.UserDefinedData where UserDefinedFieldId = 306 and UserDefinedRowId = item.UserDefinedRowId) as [pubdate]
    ,(Select 'http://www.borntowin.net/Portals/0/AudioFiles/RadioArchives/' + Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 308 and UserDefinedRowId = item.UserDefinedRowId) as [guid]
     From 
    dbo.UserDefinedRows item
     Where 
    ModuleId = 820
     and UserDefinedRowID in (select UserDefinedRowID from UserDefinedData where UserDefinedFieldID = 306 and Cast(Cast(FieldValue as nvarchar(max)) as DateTime) between '2010-Nov-11' and '2010-Nov-18') 
     Order By 
    [pubdate] DESC
    for XML AUTO,ELEMENTS

**Select #3 (more text)**  

    Select '</channel>
    </rss>'

(I am using MS SQLSMS 2008.)
(The complex nature of the second select statement is due to the fact that it is retrieving   data from a DotNetNuke "User-Defined Table/Form & List" which must first be "flattened".)


Any help would be appreciated, Thanks.




Appending Text to FOR XML SQL Select Statement
===

I have three `Select` statements I want to join:  

Select 2 is a `FOR XML` Select to which I want to append Selects 1 & 3 (which simply display some text) as a kind of header/footer.  

All three Selects work as intended and form three parts of a nicely-formed podcast .xml, but I need them to end up in one result so I can eventually save it to an .xml file (which will be my next headache, I suppose).  

I have tried permutations of `+`, `UNION`, and `JOIN` that my inexperienced mind can come up with, but to no avail. 

**Select #1 (simply some text)**  

    Select  '<?xml version=''1.0''?>
    <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
        <channel>
          <atom:link href="http://www.borntowin.net/podcast/borntowin.xml" rel="self" type="application/rss+xml" />
      <itunes:image href="http://www.borntowin.net/Portals/0/Images/Audio/podcast_logo.jpg"/>
      <link>http://www.borntowin.net/Audio.aspx</link>
    <title>Born to Win Podcast</title>
    <description>Born to Win''s Daily Radio Broadcast and Weekly Sermon</description>
    <language>en-us</language>
    <copyright>&#xA9; 2010</copyright>
          <itunes:subtitle>Making Life Work</itunes:subtitle>
          <itunes:owner>
            <itunes:name>Christian Educational Ministries</itunes:name>
            <itunes:email>webmaster@borntowin.net</itunes:email>
          </itunes:owner>
          <itunes:category text="Religion &amp; Spirituality">
            <itunes:category text="Christianity" />
          </itunes:category>
          <itunes:explicit>No</itunes:explicit>
          <ttl> 120 </ttl>'   

**Select #2 (my data)**  

    Select 
    (Select Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 305 and UserDefinedRowId = item.UserDefinedRowId) as [title]
    ,(Select 'Today''s Program is ' + Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 305 and UserDefinedRowId = item.UserDefinedRowId) as [description]  
    ,(Select Cast(Cast(FieldValue as nvarchar(max)) as DateTime) from dbo.UserDefinedData where UserDefinedFieldId = 306 and UserDefinedRowId = item.UserDefinedRowId) as [pubdate]
    ,(Select 'http://www.borntowin.net/Portals/0/AudioFiles/RadioArchives/' + Cast(FieldValue as nvarchar(max)) from dbo.UserDefinedData where UserDefinedFieldId = 308 and UserDefinedRowId = item.UserDefinedRowId) as [guid]
     From 
    dbo.UserDefinedRows item
     Where 
    ModuleId = 820
     and UserDefinedRowID in (select UserDefinedRowID from UserDefinedData where UserDefinedFieldID = 306 and Cast(Cast(FieldValue as nvarchar(max)) as DateTime) between '2010-Nov-11' and '2010-Nov-18') 
     Order By 
    [pubdate] DESC
    for XML AUTO,ELEMENTS

**Select #3 (more text)**  

    Select '</channel>
    </rss>'

(I am using MS SQLSMS 2008.)
(The complex nature of the second select statement is due to the fact that it is retrieving   data from a DotNetNuke "User-Defined Table/Form & List" which must first be "flattened".)


Any help would be appreciated, Thanks.



