title: How to save multiple xml files using SQL Server Database
body: <p>I need to create multiple xml files (per row) from single query which I did. My query is generating 10,000 xml files as you know SQL Server assign different name for each xml file now I need to save them in c:\ automatically. I can see all the files but I can’t save them any advise or help will  highly be appreciated. One more hint: from SQL server we can save each xml one by one from SQL server File tab. </p>
  
  <pre><code>    CREATE TABLE dbo.sample(
      [BTno] [nvarchar](25) NULL,
      [First_Name] [nvarchar](35) NULL,
      [Last_Name] [nvarchar](35) NULL,
      [BTid] [nvarchar](15) NULL,
  ) ON [PRIMARY];
  
  insert into dbo.sample values('1B','Vartan','Sarkis','69876');
  insert into dbo.sample values('2B','Anoush','Eric','87656');
  insert into dbo.sample values('3B','Lucine','Arpiar','65467');
  insert into dbo.sample values('4B','Anum','Noor','98076');
  insert into dbo.sample values('5B','Abercio','Banninq','34897');
  insert into dbo.sample values('1C','Gaea','Nishan','29841');
  insert into dbo.sample values('7B','Marilyn','Vahe','78903');
  insert into dbo.sample values('2Z','Bansi','Aakarshan','34905');
  insert into dbo.sample values('9S','Eric','Abban','45892');
  insert into dbo.sample values('12B','Dave','Tate','19994');
  </code></pre>
  
  <p>-- Here is the Query that generates multiple xml files</p>
  
  <pre><code>select ((select * from dbo.sample a where a.BTid = b.BTid
           for xml path('Row'),TYPE, ROOT('BT')
          )) from dbo.sample b
  </code></pre>