2010-07-28 143 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

相關問題