Reputation: 477
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?
Upvotes: 0
Views: 54
Reputation: 16137
Replace the line
art.tisa_LayoutUrl AS [image],
with:
'plan' AS "image/@tag",
art.tisa_LayoutUrl AS [image],
Upvotes: 1