How do I generate node names in a SELECT FOR XML statement?
Say I have the table:
declare @Products table (ID int, Name varchar(100))
insert into @Products (1, 'Balls')
insert into @Products (2, 'Paper')
insert into @Products (3, 'Beer')
I want the following XML output:
<Products>
<Balls @ID=1/>
<Paper @ID=2/>
<Beer @ID=3/>
</Products>
If not possible, can I use SQL Server XML DML to accomplish this?