sql server 2000视图中的数据到xml文件
我正在尝试从表中获取数据并将其存储为 XML 文件,如 此处。在视图中,我创建了以下内容:
Select [name],[surname],[age] From Students
从存储过程中,我想调用视图并将所有内容写入 xmlFile,如下所示:
bcp "SELECT * FROM DatabaseName..Students_View FOR XML Auto, Elements" queryout C:\data.xml -w -r "" -S sqlserver -T
我正确获取数据,问题是我没有获取 xml 标头。我知道该示例使用的是显式,但就我而言,我需要自动。
请帮忙
I am trying to get data from a table and store it as XML File as shown in 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:
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. I know the example is using Explicit but in my case I need Auto.
Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对这个问题进行了更好的检查。将数据从表、视图等移动到 xml 的最佳方法是使用 FOR XML EXPLICIT 并设计架构和结构,如问题中给出的链接所示
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