For XML Explicit AGAIN

  • Hi,

    Select

          'Some String' [<node_name>!<node_number>!<attribute_name>]

    For XML Explicit

    Is there any way to define <attribute_name> in the above query at runtime. Like i get a string at runtime and i want that string to be attribute name in the XML returned by FOR XML Explicit Clause. What problem i have is if i put a variable name it returns variable name in output XML rather than returning its value.

    1. One option is to generate the query dynamically. But i don't think its an option for me because i have 12 to 15 queries of this type.

    Is is possible to do with FOR XML Explicit ?? Is there any other workaround ??

    Thanks & Regards,

    Hatim Ali.

  • You could put everything you want into the select and arrange for the attributes you don't want to be null on some criteria - then they won't appear in the generated xml. 

    jt

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply