2012年3月11日 星期日

MSSQL Output in XML using For XML

參考來源
--
1:
select * from Employee for xml path, ELEMENTS XSINIL, root('Client')

2:
select Employee.ID as '@ID', FirstName,LastName,DOB ,
(select SalariedMonth as 'Month' from employeesalary where
employee.id = employeesalary.id for xml path(''),Type) as 'Salary'
from Employee
for xml path('Employee'),Elements XSINIL,root('Employees')

3:
select Employee.ID as '@ID', FirstName,LastName,DOB ,
(select SalariedMonth as 'data()' from employeesalary where
employee.id = employeesalary.id for xml path(''),Type) as 'Salary'
from Employee
for xml path('Employee'),Elements XSINIL,root('Employees')

沒有留言:

張貼留言