Tuesday, January 01, 2008

export data from sql server 2005 to xml

its very easy to export data from sql server 2005 to an xml file
without any stored procedures or anything else:

SELECT nCountryId, cName, cIso2, cIso3, cCapitalCity, cMapReference, cCurrency, cNameAr, cNameZh, cNameJa
FROM ConCountry
Where
(cName is not null or
ciso2 is not null or
ciso3 is not null or
cCapitalCity is not null or
cMapReference is not null or
cCurrency is not null or
cNameAr is not null or
cNameZh is not null or
cNameJa is not null)
and nCountryId > 0
FOR XML auto, Type, Elements <-- this is the key part of it

if you like to work with templates, the following link shows a very easy sample:
http://sqlxml.org/faqs.aspx?faq=29

1 comment:

Anonymous said...

Thanx,

It work gr8, very easy.

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge