My input xml string is
<users><id>p1</id><id>p2</id><id>p3</id></users>
i want to write an update query to update the column 'Request_Status' in my table if the id matches to the ones in the xml string
I tried this statement:
Update login set
Request_Status='A'
where
EmpId in
(
SELECT Pers.value('(id)[1]', 'nchar(10)') as 'ID'
FROM
@xmlUserId.nodes('/users') as EMP(Pers)
)
This only updates for ID p1 and not for the other 2.
I referred to this,
How to loop and parse xml parameter in sql server stored procedure
(P.S my first question here, so please excuse mistakes, unconventional elements in the post)
No comments:
Post a Comment