读取XML为行记录
复制代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1 declare @x xml
2 set @x='<book genre="security" publicationdate="2002" ISBN="0-7356-1588-2">
3 <title>Writing Secure Code</title>
4 <author>
5 <first-name>Michael</first-name>
6 <last-name>Howard</last-name>
7 </author>
8 <author>
9 <first-name>David</first-name>
10 <last-name>LeBlanc</last-name>
11 </author>
12 <PRice>39.99</price>
13</book>'
14
15
16
17SELECT nref.value('first-name[1]', 'nvarchar(50)') FirstName,
18 nref.value('last-name[1]', 'nvarchar(50)') LastName
19FROM @x.nodes('//author') AS R(nref)
20
21
登录后复制
结果为
以上就是读取XML为行记录的内容,更多相关内容请关注靠谱客(www.uoften.com)!
最后
以上就是清新樱桃最近收集整理的关于读取XML为行记录的全部内容,更多相关读取XML为行记录内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复