XML Data Type Methods, value() Method - by Mohit K. Gupta

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 749295 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 6/15/2012 8:07:33 AM
Access Restriction Public


When executing the statement in "Steps to Reproduce" to get the Deadlock Information from System Health.  All the XML is stripped away and only get the SQL Text.  

Works fine on SQL Server 2008, SQL Server 2008 R2.  SQL Server 2012 RTM (11.0.2100) different/unexpected results.
Sign in to post a comment.
Posted by Microsoft on 8/2/2013 at 5:13 AM
Hi Mohit,

This behavior is by design. The value() method will return the values of all child nodes concatenated. As you specified in your workaround already, the correct (from both result and semantic point of view) way is to use the query() method, as it returns actual XML fragments. The value() method is mostly used to "bridge the gap" between SQL world and XML world; for instance, to perform JOINS between tables by using values from the XML document(s).

We will close this issue as "by design". If you have more information and/or concerns, please open another issue here on Connect.