日期:2014-05-17 浏览次数:20400 次
select max(maxrating) from Rating
insert into RatingXML (xmlRating)
select * from openrowset (
bulk 'C:\Users\LiuKe\Desktop\XML_F52E2B62.txt ',single_blob) as x;
select xmlRating.query ( for $c/maxrating in '/root/Rating/maxrating'
where $c/maxrating = max('/root/Rating/maxrating') return $c) as result
from RatingXML
select o.value('maxrating[1]','varchar(10)') 'maxrating'
from RatingXML a
cross apply xmlRating.nodes('/root/Rating') x(o)
/*
maxrating
----------
0.41
0.37
0.94
0.73
0.60
0.99
(6 row(s) affected)
*/
select max(maxrating) 'max_maxrating'
from
(select o.value('maxrating[1]','varchar(10)') 'maxrating'
from RatingXML a
cross apply xmlRating.nodes('/root/Rating') x(o)) t
/*
max_maxrating
-------------
0.99
(1 row(s) affected)
*/