Re: xquery FLOWR - Let keywork doesn't seem to work
- From: "Bob Beauchemin" <bobb_no_spam@xxxxxxxxxxxxx>
- Date: Wed, 24 Jan 2007 14:26:34 -0800
Hi Joyce,
XQuery has a built-in distinct-values() function and SQL Server XQuery
supports this function. As you found out, SQL Server's XQuery does not
support the 'let' part of FLWOR (so it supports FWOR expressions),
regardless of the XQuery method used.
Cheers,
Bob Beauchemin
http://www.SQLskills.com/blogs/bobb
"joyce chan" <joyceschan@xxxxxxxxxxx> wrote in message
news:1169668347.867422.40990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I was trying to get distinct values of a sequence, but I didn't want
the results to return as atomic values
So after looking at this like from Oracle
http://www.oracle.com/technology/oramag/oracle/03-nov/o63dev_xml.html
I tried to write something like this
------------------------------------------------------------------------
declare @x xml
set @x=(select xml_field from aTable for xml auto, elements, type)
select @x.query('
let $region := distinct-values(/Map/Region)
for $city in $region
return <City>{ $city }</city>
')
------------------------------------------------------------------------
and I got the message 'XQuery [query()]: The XQuery syntax 'let' is not
supported.'
So, am I doing something wrong here? If there's no 'let' in SQLserver,
how can I choose distinct elements?
Thanks!
.
- References:
- xquery FLOWR - Let keywork doesn't seem to work
- From: joyce chan
- xquery FLOWR - Let keywork doesn't seem to work
- Prev by Date: Re: xquery FLOWR - Let keywork doesn't seem to work
- Next by Date: Re: Get Position() Value in XML.Query
- Previous by thread: Re: xquery FLOWR - Let keywork doesn't seem to work
- Next by thread: Re: xquery FLOWR - Let keywork doesn't seem to work
- Index(es):