Anda juga dapat memperpanjang prosedur tersimpan SQL Server untuk mengekspornya ke file xml.
Tetapi Anda perlu mengkonfigurasi server sql sebelum Anda dapat menggunakannya.
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE
Setelah xp_cmdshel diaktifkan di SQL Server. Anda dapat menggunakan perintah berikut untuk mengekspor data ke file xml.
EXEC xp_cmdshell 'bcp "SELECT [Created], [Text] FROM [db304].[dbo].[SearchHistory] FOR XML PATH(''Record''), ROOT(''SearchHistory'')" queryout "C:\bcptest.xml" -T -c -t,'