본문 바로가기

Database/MS-SQL

DB XML 데이터 형식

반응형


구문
SELECT * FROM userTbl FOR XML RAW, ELEMENTS, XMLSCHEMA








컨트롤 + T 를 누르고 F5번 누르면 ~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

TEXT 형식으로 나온다



컨트롤 + D 를 누르고 F5번 누르면 ~!!!!!!!!!!!

MSSQL로 볼수있다






SELECT * FROM userTbl FOR XML RAW, ELEMENTS, XMLSCHEMA




SELECT * FROM userTbl FOR XML RAW, ELEMENTS  (가장효율적으로 보는것)







SELECT * FROM userTbl FOR XML RAW













////////////////////////////////////////////////////////////////////
////////////////////      XML 출력하는방법               ////////////////
///////////////////////////////////////////////////////////////////

USE sqlDB;
SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW;

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW ('회원');

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW ('회원') , ROOT;

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW , ELEMENTS;                 

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW , XMLDATA;

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML RAW , XMLSCHEMA;

SELECT userId,name,addr,height FROM userTbl 
WHERE height > 180
FOR XML AUTO;

SELECT userId,name,addr,mobile1, mobile2 FROM userTbl 
WHERE height > 180
FOR XML AUTO, ELEMENTS;

SELECT userId,name,addr,mobile1, mobile2 FROM userTbl 
WHERE height > 180
FOR XML AUTO, ELEMENTS XSINIL;