I know the contents of @message_body are:
I want to put 'DocNo' into a variable I created
@DocNo and have tried various this such as:
SET @DocNo = (SELECT ref.value('@DocNo', 'nvarchar(255)') FROM @message_body.nodes('//Sample_Message') T(ref))
with no luck. I don't have much experience parsing XML with SQL. Any suggestions?