Get the attribute value from XML

The SP return one XML, from that XML I need to get one attribute value. Please tell me how to do ?

EG:



I need to get the top 1 EngagementId from that XML. The XML value I set in one variable after that I get the attribute value then need to return that value only.

Because of the funny behavior of the site, the XML you posted (if you did post any) is not visible. Not your fault, the site behaves in unexpected ways when trying to post XML.

The example posted may have nothing to do with what you are asking, but hopefully it will give you some ideas

DECLARE @x XML = 
'<root>
  <node1 a="17" b="18">
	SomeNode1
	</node1>
  <node1 a="27" b="28">
	SomeOtherNode1
	</node1>
</root>';

SELECT
	c.value('.','VARCHAR(32)') AS NodeText,
	c.value('./@a','INT') AS A,
	c.value('./@b','INT') AS B
FROM
	@x.nodes('//node1') T(c);

oh ok. Thanks for your help and thanks for the reply.