Home Forums Programming XML adding an xml root attribute RE: adding an xml root attribute
Adrian Nichols-360275
SSCertifiable
Points: 7694
More actions
October 3, 2007 at 10:15 am
#738686
Hi,
It's a bit crude and not very pretty but it does the job!
DECLARE @xml VARCHAR(4000)
SELECT @xml = (SELECT name as '@name', xtype as 'data/@field1'
FROM sysobjects
FOR XML PATH('object'), ROOT('root'))
SELECT REPLACE(@xml, ' ')
A Freudian Slip is when you say one thing and mean your mother.For detail-enriched answers, ask detail-enriched questions...[/url]