You could alias @@rowcount
to '@id'
, like:
declare @t table (name varchar(25))
insert @t (name) values ('jddjdjd')
select @@rowcount as '@id'
, name
from @t
for xml path('row'), root('rows')
This prints:
<rows>
<row id="1">
<name>jddjdjd</name>
</row>
</rows>
However, I'm not sure it's clearly defined what @@rowcount
means at the point where it gets turned into an attribute.
Andomar
2010-10-31 11:32:36