2010-07-28 142 views
0

我在sql server 2008中有一个数据库。我想将它转换为xml格式。我必须做什么?什么是程序?请指导我。我不想用任何语言编写代码。有没有在SQL Server 2008中提供的任何设施?如何将sql server 2008数据库转换为其xml格式?

+0

这是一个编码Q&A网站,所以如果你不想代码, – 2010-07-28 14:26:16

+1

你需要给我们多一点去,你可能会问错了地方比起那个来说。 'exec sp_MSforeachtable @ command1 ='SELECT * FROM?对于xml auto''会做你想要的东西。 – 2010-07-28 14:29:10

+0

可能是我说对不起。但重点是要点。如果你不能回答,请不要发现错误(帕特里克)。 – 2010-07-29 08:04:27

回答

2

看看这个解决方案在这里:http://sqlxml.org/faqs.aspx?faq=29

它使用一个存储过程来一个结果导出到XML。这是一篇旧文章,但可能值得一试。我没有测试过,所以你的里程可能会有所不同。

从网站:

You first generate a file with the text-editor like: 

<root> 
<%begindetail%> 
<%insert_data_here%> 
<%enddetail%> 
</root> 

Save it as c:\temp\template.tpl 

Next you open QA and type: 


sp_makewebtask @outputfile = 'c:\temp\myxmlfile.xml', 
    @query = 'select * from sysobjects for xml auto', 
    @templatefile = 'c:\temp\template.tpl' 

The Result is a XML-File! 
+0

谢谢艾莉森,我希望这应该工作,我会尽力并会回来。 – 2010-07-29 08:05:34

相关问题