I have a table with 2 columns. The column response is an XML data type column (I am able to click on it an open the XML document). I would like to have a code that would export each row of the column response into an XML document saved on my desktop. Path = C:\Users\SAM\Desktop\Folder
.
我有一个2列的表。列响应是XML数据类型列(我可以单击它打开XML文档)。我想有一个代码,可以将列响应的每一行导出到保存在桌面上的XML文档中。 Path = C:\ Users \ SAM \ Desktop \ Folder。
So I would have an XML document for each row.
所以我会为每一行都有一个XML文档。
Output:
SELECT * FROM Table
Data Response
20130101 <Getresponsequ…
20130102 <Getresponsequ…
20130103 <Getresponsequ…
20130104 <Getresponsequ…
20130105 <Getresponsequ…
20130106 <Getresponsequ…
I am using Microsoft SQL Server Management Studio.
我正在使用Microsoft SQL Server Management Studio。
Thanks in advance!
提前致谢!
1 个解决方案
#1
1
You can use bcp Utility to export query results to xml files.
It can be used from command prompt.
For example:
您可以使用bcp Utility将查询结果导出到xml文件。它可以在命令提示符下使用。例如:
bcp "SELECT Response FROM [DB].dbo.[Table] WHERE Data = '20130101'" queryout "C:\Users\SAM\Desktop\Folder\20130101.xml" -c -S {ServerName} -U sa -P {password}
#1
1
You can use bcp Utility to export query results to xml files.
It can be used from command prompt.
For example:
您可以使用bcp Utility将查询结果导出到xml文件。它可以在命令提示符下使用。例如:
bcp "SELECT Response FROM [DB].dbo.[Table] WHERE Data = '20130101'" queryout "C:\Users\SAM\Desktop\Folder\20130101.xml" -c -S {ServerName} -U sa -P {password}