Thanks for the response, but that wasn't quite what I was looking for.
your query:
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, ' ')
errors at the replace statement saying that replace requires 3 arguments.
I believe what you were trying to accomplish was:
SELECT name as '@name', replace(xtype, ' ','') as 'data/@xtype'
FROM sysobjects
FOR XML PATH('object'), root('root')
which returns:
<root>
<object name="sysrowsetcolumns">
<data xtype="S" />
</object>
...
</root>
All I'm trying to do is add a timestamp attribute to the root tag:
<root timestamp="Oct 3 2007">
Thanks again,
--Adam