• I don't know if anyone else has already pointed this out, but I was able to add a root node by specifying

    FOR XML EXPLICITY, ROOT('CustomersByRegion')

    The code below generated fully formed XML:

    select

    1 as tag,

    null as parent,

    c.countryname as 'Country!1!name',

    c.currency as 'Country!1!currency',

    null as 'City!2!name',

    null as 'Customer!3!id',

    null as 'Customer!3!name',

    null as 'Customer!3!phone'

    from

    countries c

    union all

    select

    2 as tag,

    1 as parent,

    co.countryname,

    co.currency,

    ci.cityname,

    null,

    null,

    null

    from

    cities ci

    inner join

    countries co

    on

    ci.countryID = co.countryid

    union all

    select

    3 as tag,

    2 as parent,

    co.countryname as [name],

    co.currency,

    ci.cityname as [name],

    cu.customernumber as [id],

    cu.customername as [name],

    cu.phone

    from

    customers cu

    inner join

    cities ci

    on

    cu.cityid = ci.cityid

    inner join

    countries co

    on

    ci.countryid = co.countryid

    order by

    'Country!1!name',

    'City!2!name'

    for xml explicit, root('CustomersByRegion')

    John