DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
 
 
SITE SEARCH SQLUSA.com VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
How to export table content into XML file?

Microsoft SQL Server database table content can be exported into XML format file with a simple bcp statement. One way of executing it is from cmdshell as script. The second way is a stored procedure with xp_cmdshell.


bcp "SELECT FirstName, LastName, Phone, EmailAddress
FROM AdventureWorks.Person.Contact
WHERE LastName LIKE 'A%' ORDER BY LastName, FirstName
FOR XML AUTO, TYPE, XMLSCHEMA, ELEMENTS XSINIL "
queryout Contact.txt -c -Sservername -Usa -Ppassword

Related article:

Examples of Bulk Importing and Exporting XML Documents

 

Exam Prep 70-461
SQL 2016 DESIGN & PROGRAMMING
 
 
 
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE