ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Ahmed Abouzaid , Senior Software Engineer / .Net / Outsystems , Emaratech
تاريخ النشر: 2013/09/08
Ahmed Abouzaid
من قبل 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

 

المزيد من الأسئلة المماثلة