create xml file from sql script
Declare @xmlDoc xml
SET @xmlDoc = (SELECT * FROM USERS AS UserTable For XML AUTO, ELEMENTS, ROOT('Root'))
SELECT @xmlDoc
Result as below :
<Root>
<UserTable>
<UserDBID>1</UserDBID>
<UserID>Admin </UserID>
<UserName>admin</UserName>
<Password>49CE5FB6D05148ACB66A</Password>
<FullName />
<LocalFullName />
<Title />
<Department />
<UserRole>Administrator</UserRole>
<IsFirstLogin>0</IsFirstLogin>
<PwdNeverExpire>1</PwdNeverExpire>
<PwdLastModifyTime>2013-07-10T13:40:48.470</PwdLastModifyTime>
</UserTable>
<UserTable>
<UserDBID>2</UserDBID>
<UserID>cshsvc </UserID>
<UserName>cshsvc</UserName>
<Password>54C0FCD2B54CCE8BE6AD</Password>
<FullName />
<LocalFullName />
<Title />
<Department />
<UserRole>Administrator</UserRole>
<IsFirstLogin>0</IsFirstLogin>
<PwdNeverExpire>1</PwdNeverExpire>
<PwdLastModifyTime>2013-07-10T13:38:25.070</PwdLastModifyTime>
</UserTable>
</Root>
SelectEmp_Id,Emp_Namefrom tblEmployee WhereEmp_Id<3For XML AUTO,ELEMENTS
--For XML [MODE],ELEMENTS
MODE
AUTO, RAW, EXPLICIT
Result [AUTO]
<tblEmployee><Emp_Id>1</Emp_Id><Emp_Name>AAA</Emp_Name></tblEmployee><tblEmployee><Emp_Id>2</Emp_Id><Emp_Name>BBB</Emp_Name></tblEmployee>
Result [RAW]
Above Xml with Instead of <tblEmployee> here..... <ROW> and </tblEmployee> is </ROW>
SELECT ( SELECT 'White' AS Color1,
'Blue' AS Color2,
'Black' AS Color3,
'Light' AS 'Color4/@Special',
'Green' AS Color4,
'Red' AS Color5
FOR
XML PATH('Colors'),
TYPE
),
( SELECT 'Apple' AS Fruits1,
'Pineapple' AS Fruits2,
'Grapes' AS Fruits3,
'Melon' AS Fruits4
FOR
XML PATH('Fruits'),
TYPE
)
FOR XML PATH(''),
ROOT('SampleXML')
GO
create xml file from sql script的更多相关文章
- persistent.xml hibernate 利用sql script 自定义生成 table 表
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http:// ...
- LinqToXml (一) Create Xml file By Dom /Linq
目前,在xml 应用编程领域比较流行的开发模型是W3C 提供的DOM(文档对象模型),在.net Framework 通过命名空间 System.Xml 对该技术提供了支持.随着Linq to XMl ...
- Create XML Files Out Of SQL Server With SSIS And FOR XML Syntax
So you want to spit out some XML from SQL Server into a file, how can you do that? There are a coupl ...
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
In this Document Goal Solution 1: How do you enable trace for an API when executed from a SQL ...
- csharp:SMO run sql script
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- [vb.net]XML File Parsing in VB.NET
Introduction Parsing XML files has always been time consuming and sometimes tricky. .NET framework p ...
- How to: Write Object Data to an XML File
This example writes the object from a class to an XML file using the XmlSerializer class. Namespace: ...
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.L ...
- SQL SERVER – Import CSV File Into SQL Server Using Bulk Insert – Load Comma Delimited File Into SQL Server
CSV stands for Comma Separated Values, sometimes also called Comma Delimited Values. Create TestTabl ...
随机推荐
- ArrayBuffer对象、TypedArray视图和DataView视图
转:http://es6.ruanyifeng.com/#docs/arraybuffer ArrayBuffer ArrayBuffer 对象 TypedArray 视图 复合视图 DataView ...
- 洛谷P4151 [WC2011] 最大XOR和路径 [线性基,DFS]
题目传送门 最大XOR和路径 格式难调,题面就不放了. 分析: 一道需要深刻理解线性基的题目. 好久没打过线性基的题了,一开始看到这题还是有点蒙逼的,想了几种方法全被否定了.还是看了大佬的题解才会做的 ...
- Python并发编程-管道
管道的作用- 两个进程间传递消息 from multiprocessing import Pipe, Process def func(conn1,conn2): conn2.close() #子进程 ...
- java 读入文件 FileInputStream
package com.mkyong.io; import java.io.File; import java.io.FileInputStream; import java.io.IOExcepti ...
- UESTC 1330 柱爷与远古法阵【高斯消元】
题目链接[http://acm.uestc.edu.cn/#/problem/show/1330] 题意:有一个长度为L(L <= 300)的长廊,有一人站在最左边,他要到最右边去,他每次可以走 ...
- Codeforces 1037 H. Security
\(>Codeforces \space 1037\ H. Security<\) 题目大意 : 有一个串 \(S\) ,\(q\) 组询问,每一次给出一个询问串 \(T\) 和一个区间 ...
- 【lct】bzoj2002 [Hnoi2010]Bounce 弹飞绵羊
lct板子,此题主要有cut操作和link操作. #include<cstdio> #include<iostream> #include<cstring> #in ...
- SpringBoot返回结果如果为null或空值不显示处理方法
第一种方法:自定义消息转换器 @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter{ // /** // * ...
- Java反射机制涉及的类常见方法使用总结
import java.lang.reflect.Constructor; import java.lang.reflect.*; /*Class:代表一个字节码文件的对象,每当有类被加载进内存,JV ...
- 【ArcGIS笔记】数据处理
1.ARCGIS在导入Excel坐标点的时候出现"没有注册类"的情况怎么办? 确保你本机上装有office,并且版本要能够识别XLSX格式.2007以上. 2.导入excel时re ...