title: Garbage characters while converting results into xml in SQL
body: <p>Garbage characters are comming while converting my table results into xml </p>
  
  <p>Following is the sql code which i am using </p>
  
  <pre><code>CREATE TABLE #tbl
  (
  RowID INT
  , Comments NVARCHAR(MAX)
  )
  
  -------------------------------
  
  
  INSERT INTO #Tbl(RowID, Comments) VALUES (1, '&amp;test 123123123 &amp; test
  test123&amp;
  ' )
  INSERT INTO #Tbl(RowID, Comments) VALUES (2, '&amp;test 123123123 &amp; test' )
  INSERT INTO #Tbl(RowID, Comments) VALUES (3, '&amp;test 123123123 &amp; test
  test123&amp;
  &amp;&amp;' )
  
  ------------------------------------
  
  
  SELECT  
      (
          SELECT distinct  
              RowId       
  
              ,Comments AS Comments
          FROM  
              #tbl AS t
          FOR XML RAW, TYPE
      )FOR XML PATH('Table'), TYPE
  
  
  ------------------------------------
  
  DROP TABLE #tbl
  </code></pre>
  
  <p>Can anyone help me in this regard. Thanks in advance.</p>