简体   繁体   English

使用SQL Server 2008将所有数据库数据导出为xml格式

[英]export all database data to xml format with SQL Server 2008

I have .bak format file with database from another company. 我有来自另一家公司的数据库的.bak格式文件。 After a long time of configuration SQL Server I have access to this data but Is there any way to export all database to XML format? 经过长时间的配置,SQL Server我可以访问此数据,但是是否可以将所有数据库导出为XML格式? Is there easiest way than export every table by typing: 有没有比通过键入以下命令导出每个表更简单的方法:

SELECT * from MLS.dbo.Offers

FOR XML AUTO

Not an exact answer but following SQL will help you to list down all the schema and table names. 不是确切的答案,但是遵循SQL可以帮助您列出所有架构和表名称。 And you can build a dynamic SQL thing around this result set to achieve what you want. 您可以围绕此结果集构建动态SQL事物,以实现所需的结果。

SELECT DISTINCT
       DB_NAME() AS [Database],
       SCHEMA_NAME(SCHEMA_ID) AS [Schema],
       Name AS [Table]
FROM sys.tables
ORDER BY 1,2;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM