Home Forums Programming XML adding an xml root attribute RE: adding an xml root attribute

  • Using Dan's method of building the root tag manually, I got everything to work with the path() command as well. It's really just a "Nested FOR XML Query" (that's the title of the bol entry) which looks something like this:

    SELECT getDate() as '@timestamp',

    (select name as '@name', xtype as 'data/@xtype'

    from sysobjects

    for xml path('object'), type

    )

    FOR XML PATH('root')

    Thanks for the help!

    --Adam