Working with XML in SQL Server 2000

Unfortunetly sometimes we have to work with old technologies (like mssql 2000).
So, this tip is about how to generate a xml from a select statment.

The big deal is FOR XML clause.

— Basic way to generate the xml
SELECT name
,salary
FROM employe
FOR XML AUTO

— Generates with elements
SELECT name
,salary
FROM employe
FOR XML AUTO, ELEMENTS

— Generates the schema
SELECT name
,salary
FROM employe
FOR XML AUTO, XMLDATA

see ya