Searching xml field in stored procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • programmher
    New Member
    • Jan 2014
    • 19

    Searching xml field in stored procedure

    please see below code.


    I need to set mystring to equal whatever exists in the authors field. I am using this in a stored procedure. what I use to search on the field isn't working below but this isn't working when I try and set @mystring to that value.

    CData field has these values <fields>
    <ReqDate>1/28/2014</ReqDate>
    <ReqLibrary>Mai n</ReqLibrary>
    <Authors>Robb , King, Saul</Authors>
    </fields>


    HEre is what works when I just try and search using a
    SELECT command:

    Code:
    CData.value('(/fields/Authors)[1]', 'nvarchar 255)')
    I am attaching my other script because I am unable to insert in between the CODE tags and save it to this post.
    Attached Files
Working...