Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is SQL server bulk copy utility and how to use it to export data to XML file?

user-image
Question ajoutée par Ahmed Abouzaid , Senior Software Engineer / .Net / Outsystems , Emaratech
Date de publication: 2013/09/08
Ahmed Abouzaid
par Ahmed Abouzaid , Senior Software Engineer / .Net / Outsystems , Emaratech

SELECT 

emp.Name ,

emp.Salary + emp.extras as Total

FROM dbo.Employee emp 

FOR XML AUTO,TYPE, ELEMENTS ,ROOT('Salaries')

 

--result will apeare in SQL server management studio

 

--to export it to physical drive you must put this query in BCP like this

--put this query to BCP and replace "localhost" with your server name and replace path or file name

 

BCP "SELECT 

emp.Name ,

emp.Salary + emp.extras as Total

FROM dbo.Employee emp

FOR XML AUTO,TYPE, ELEMENTS ,ROOT('Salaries')" 

QUERYOUT "C:\Salaries.XML" -c -t -T -S localhost -- your path and your server name

 

More Questions Like This