--Generate xml file from dataSource
USE [Northwind]
GO
EXEC sp_makewebtask
@outputfile = 'd:\51aspx.xml',
@query='SELECT * FROM [shippers] FOR XML AUTO',
@templatefile='D:\shippers.txt'
------------------------------------------------------
USE [Northwind]
GO
DECLARE @FileName VARCHAR(50),@bcpCommand VARCHAR(2000)
SET @FileName = 'D:\shippers.txt'
SET @bcpCommand = 'bcp "select * from Northwind..shippers " query out "'
SET @bcpCommand = @bcpCommand + @FileName + '" -T -c -t "~|~" -r "^$^"'
EXEC master..xp_cmdshell @bcpCommand