简体   繁体   English

sql 服务器 2000 数据查看 xml 文件

[英]sql server 2000 data in view to xml file

I am trying to get data from a table and store it as XML File as shown in Here .我正在尝试从表中获取数据并将其存储为 XML 文件,如Here所示。 In a view I created the following:在一个视图中,我创建了以下内容:

Select [name],[surname],[age] From Students

and from a stored procedure I want to call the view and write everything to an xmlFile as below:并从存储过程中,我想调用视图并将所有内容写入 xmlFile,如下所示:

bcp "SELECT * FROM DatabaseName..Students_View FOR XML Auto, Elements" queryout C:\data.xml -w -r "" -S sqlserver -T

I am getting the data correctly, the problem is I am not getting the xml header.我得到了正确的数据,问题是我没有得到 xml header。 I know the example is using Explicit but in my case I need Auto.我知道该示例使用的是 Explicit,但在我的情况下我需要 Auto。

Please help请帮忙

checked better on the issue.更好地检查了这个问题。 best way to move data from a table,view etc... to xml is to use FOR XML EXPLICIT and design the schema and structure as shown in the link given out in the question将数据从表、视图等移动到 xml 的最佳方法是使用 FOR XML EXPLICIT 并设计架构和结构,如问题中给出的链接所示

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

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