July 22, 2009 at 10:20 am
I want to pass this value as XML String to a SP and read back the values
in such a way that i am going write three conditions like.
IF @Condition ='DRAFT'
BEGIN
END
IF @Condition ='SUBMITTED'
BEGIN
END
IF @Condition =DELIVERED
BEGIN
END
Please help me![/font]
July 22, 2009 at 10:54 am
I'm sure there's more to the story. Why not just pass the Condition value in as a varchar parameter? Are there other attributes in your XML that you want to deal with? Are you trying to pass a table into a procedure?
What does your XML look like?
July 22, 2009 at 12:38 pm
DRAFT
July 22, 2009 at 12:43 pm
I don't think you post showed up as you expected. You may want to use the 'Preview' option before posting.
July 22, 2009 at 3:23 pm
Hi Sirish,
the first "issue": if you're posting xml data please use the [ code="xml" ] tag without spaces. This site has some difficulties to display xml structure properly if xml data are not qualified properly.
Regarding your question:
The following code snippet may help you to get your requirement resolved:
DECLARE @xml XML
SELECT @xml='
Draft
submitted
delivered'
IF (SELECT @xml.exist('/MessageStatus/Status[.="Draft"]'))=1
BEGIN
SELECT 'path 1'
END
IF (SELECT @xml.exist('/MessageStatus/Status[.="submitted"]'))=1
BEGIN
SELECT 'path 2'
END
IF (SELECT @xml.exist('/MessageStatus/Status[.="delivered"]'))=1
BEGIN
SELECT 'path 3'
END
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply