简体   繁体   English

将XML数据从文件导入SQL Server 2008 R2数据库

[英]Importing XML data from file into SQL Server 2008 R2 Database

I have looked into this and cannot find a suitable answer. 我已经调查过此内容,却找不到合适的答案。 I want to import data from a .xml file into a SQL database from within SQL Server Management Studio (SSMS). 我想将数据从.xml文件导入到SQL Server Management Studio(SSMS)内的SQL数据库中。 I can do this from C# without issue and this is not my problem. 我可以从C#做到这一点而没有问题,这不是我的问题。 A client want some data in XML format but also wants to be able to check this data for themselves. 客户端需要一些XML格式的数据,但也希望能够自己检查这些数据。 Rather than writing a program for them I want to supply them with a query that they can execute from within SSMS. 我不想为他们编写程序,而是向他们提供可以在SSMS中执行的查询。 There is alot of data and some of the methods I have read as solutions to simalar questions are not suitable for this case. 有大量数据,我已经阅读了一些解决小问题的方法,因此不适合这种情况。

The .xml file was written using a set .xsd schema file and I would like to maintain the structure of the data in the .xml file when it is imported into tables in the SQL database. .xml文件是使用一组.xsd模式文件编写的,当我将.xml文件中的数据导入到SQL数据库中的表中时,我想保持该数据的结构。 Any help is greatly appreciated... 任何帮助是极大的赞赏...

Can anyone tell me the best way to go about doing this? 谁能告诉我最好的方法吗?

您可以查看创建一个存储过程,该过程将接受XML参数或XML文档片段,类似于本文中所示的方式(忽略将对象序列化为XML的C#代码)

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

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