Please take some time to read this welcome message that can help you find your answer quicker.
Please take a look at previous postings to see whether your question already has been asked and answered before. Also please check out some of the online resources and documentations that are relevant to this area.
If none of these resources provide you with the answer that you are looking for, or you are not interested in reading lots of interesting material, feel free to post your question.
When you post questions here, please strive to follow the following guidelines (which I shamelessly stole and adopted from the TSQL forum announcement):
a) Post the simplest possible repro. Please do some up-front debugging and detective work, and post the narrowest possible repro. It's not helpful if you post 5 pages of code or ask a very wide question that can have multiple interpretations.
b) Post the DDL of your relational and XML schema so that we know the data types, NULL-ability, and constraints.
c) Please provide the received and expected result if possible.
d) Please indicate exactly which version and SP of SQL Server you are using.
e) Please indicate any additional info that may be useful, e.g., perf counters, SQL error log messages, NT event log messages, etc.
f) Provide the text query plan (or XML Showplan for SQL Server 2005) if needed.