0

I need to add an attribute tag='plan' to the column tisa_LayoutURL with the node Image. See my query below

select @xml = 
    (
            SELECT art.tisa_Code AS [@internal-id],
                cla.tisa_image1 AS [image], '',
                cla.tisa_image2 AS [image], '',
                cla.tisa_image3 AS [image], '',
                cla.tisa_image4 AS [image], '',
                art.tisa_LayoutUrl AS [image],
                addr.tisa_Description AS [description]
    FROM tisa_article art JOIN 
         tisa_Address addr ON addr.tisa_AddressId = art.tisa_AddressId JOIN
         tisa_Classifier cla ON cla.tisa_classifierid = addr.tisa_classifierid 
    JOIN
         Account Acc ON Acc.AccountId=cla.tisa_vendorid
    FOR XML PATH('offer'), root('realty-feed'))

I need to obtain the following:

<image>xxxxx.jpg</image>
<image>xxxx1.jpg</image>
<image>xxxx2.jpg</image>
<image>xxxx3.jpg</image>
<image tag="plan">xxxx4.jpg</image>

how can i modify my query to achieve that?

1
  • I'm assuming you are working in a SQL Server database? Commented Aug 21, 2017 at 14:30

1 Answer 1

1

Replace the line

art.tisa_LayoutUrl AS [image],

with:

'plan' AS "image/@tag",
art.tisa_LayoutUrl AS [image], 
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! It helped me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.