openxml in sql server

OPENXML (Transact-SQL)

OPENXML provides a rowset view over an XML document. Because OPENXML is a rowset provider, OPENXML can be used in Transact-SQL statements in which rowset providers such as a table, view, or the OPENROWSET function can appear.

https://docs.microsoft.com/en-us/sql/t-sql/functions/openxml-transact-sql?view=sql-server-2017

https://docs.microsoft.com/en-us/sql/relational-databases/xml/examples-using-openxml?view=sql-server-2017

 

XML System Stored Procedures

SQL Server provides the following system stored procedures that are used together with OPENXML:

  • sp_xml_preparedocument (Transact-SQL)

  • sp_xml_removedocument (Transact-SQL)

    To write queries by using OPENXML, you must first create an internal representation of the XML document by calling sp_xml_preparedocument. The stored procedure returns a handle to the internal representation of the XML document. This handle is then passed to OPENXML. OPENXML provides rowset views of the document based on XPaths. Specifically, this is one row pattern and one or more column patterns.

Note

The document handle that is returned by sp_xml_preparedocument is valid for the duration of the session.

The internal representation of an XML document can be removed from memory by calling the sp_xml_removedocument system stored procedure.

 

已经不建议用这个

https://stackoverflow.com/questions/49272564/openxml-returning-null

https://stackoverrun.com/cn/q/1573581

 

 

 

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(414)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-09-26 IIS访问站点,出现connection refused
2016-09-26 Entity Framework 与多线程
2015-09-26 使用git批量删除分支
点击右上角即可分享
微信分享提示