XQuery 1.0 to get Node with max value in Sql

SYNTHROIDBUY

New Member
the following sql query works but will not treat the content of the 'Price' node as an integer. But rather as a string. Therefore it will return me 80 instead of 200.declare @xmldata xmlset @xmldata = http://stackoverflow.com/questions/10987307/\[code\]'<Node> <House> <Price>80</Price> </House> <House> <Price>200</Price> </House></Node>'\[/code\]-- Get the house with highest priceselect
cast(@xmldata as xml).value('(//House[not(//House/Price > Price)]/Price)[1]', 'nvarchar(max)')Question:What is the correct XQuery (1.0) to use for that ?I don't want to use the fn:max XQuery 2.0 function.Thanks a lot for your help !Pat.
 
Back
Top