A question about using exist() method against XML column

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi all,
I have a question:
When I execute this query:

select * from Users where MyXmlColumn.exist('/user[@userid = "1000" and @username = "user01"] ') = 1

the result set contains only one row that I expected.

but while I change the query to:
select * from Users where MyXmlColumn.exist('/user[@userid = "1000"] and /user[@username = "user01"] ') = 1

the result set always contains all users.

What's wrong with my 2nd query?
the function exist('/user[@userid = "1000"] and /user[@username = "user01"] ') always return 1 here.

btw, I read "XQuery Against the xml Data Type" of "SqlServer2005 Books Online", but I didn't got some specific details on this.
which section should I read carefully?


Thanks!!


.



Relevant Pages

  • Re: Finally which ORM tool?
    ... manipulate the linq query IF you're executing it at that moment. ... simply because the declaration construction was with 'CHOPS'. ... implement IEnumerablebut had an Execute() method which gave back ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: SQL stored procedure executing twice
    ... I wasn't aware that DLookupwould execute the "domain" more than once. ... caused the stored procedure to execute twice. ... Dim stDocName As String ... My pass-thru query properties ...
    (microsoft.public.access.modulesdaovba)
  • Re: Clarification on DBI module
    ... You get the same results for the second execute because the record buffer in the statment handle is not cleaned out because no execute took place. ... The sql query can have bind variables or they may not have. ... Ahhh...imagining that irresistible "new car" smell? ...
    (perl.dbi.users)
  • RE: Running action function from SELECT query
    ... Yes ADO can execute queries saved in an Access database. ... I do not know how ADO.NET works, but the developer tells me he is able to ... At any rate, I can call just a function from a query, like this: ...
    (microsoft.public.access.modulesdaovba)
  • Re: UPDATE query in Access 2003 raising error
    ... Runtime error 3066 Query must have at least one destination field. ... The SQL works fine if I use it in the QBF Design mode. ... Set qdfTemp = db.CreateQueryDef ... Elsewhere in the code I use the same technique to execute an SQL ...
    (microsoft.public.access.formscoding)