SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


XQUERY In sql server


XQUERY In sql server

Author
Message
SQL*
SQL*
SSChasing Mays
SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)

Group: General Forum Members
Points: 658 Visits: 1726
Hi,

I'm very new to XQuery's, here i need a situation to Join two different xml's and apply some filter conditions.
From the below URL we can write the XQuery
[url=http://www.datypic.com/books/xquery/chapter03.html][/url]

But how can we use this in SQL Server.

:-)
Orlando Colamatteo
Orlando Colamatteo
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14999 Visits: 14396
I am not exactly sure what you're after but if you provide two sample XML documents and your expected results per your thoughts on the filtering and joining requirement you mentioned we can take it from there.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
SQL*
SQL*
SSChasing Mays
SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)SSChasing Mays (658 reputation)

Group: General Forum Members
Points: 658 Visits: 1726
opc.three (2/13/2013)
I am not exactly sure what you're after but if you provide two sample XML documents and your expected results per your thoughts on the filtering and joining requirement you mentioned we can take it from there.


I have a scenario like, in the table few xml data types, example Location it is having country/State data in xml, all this information is related to user (Userid)
<Location>
<Country Name="India">
<State>HR</State>
<Country Name="UK">
<Country Name="USA">
</Location>

We need to query the above xml based on input xml looks same as above, and one extra parameter is @Operatior = And/Or if we send AND then the user Location xml must contain all the input countries if it is or then if is enough to any one country exist in user table of Location field (xml).

Please provider your inputs on this.

:-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search