For XML ???

  • Is there an option you can add to a sql query that would give me XML output which also includes the datatype.

    Example:

    I would like the XML output to show

    <property name="LinkNumber" type ="Integer">101</property>

    I am able to get the XML output using "For XML" in the sql but it does not display the "data type" field along with it.

    It would be great if someone knows how this can be achieved.

    Thank you

     

     

  • No, there is no built-in way that I know of to do this with For XML but you could enhance your query to look up the datatypes for your table from the system tables and return them as attributes.

  • you could use XSLT to transform your results into the format you want.  but i don't know of a way to add attributes to what SQL Server generates.

  • Thank you both for your reply. I am going to investigate further into XSLT approach.

Viewing 4 posts - 1 through 3 (of 3 total)

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