무엇
SELECT
OutputXML.value('(storage/@created-on)[1]','date')
AS ProductType,*
FROM [DataOutput];
당신은 당신의 쿼리에 대한 네임 스페이스를 지정해야합니다
declare @t table (a xml)
insert into @t(a) values ('<storage xmlns="http://energy" created-on="2013-01-21T05:00:15Z">
<country>Italy</country>
<Points>
<point>Callato;Cellino</point>
</Points>
</storage>')
SELECT
a.value('declare namespace x = "http://energy";
(x:storage/@created-on)[1]','date')
AS ProductType,*
FROM @t;
나 ' 여기서는 가독성을 위해 두 줄로 나누었습니다. 그러나 그렇게 할 필요는 없습니다.
결과 :
ProductType a
----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2013-01-21 <storage xmlns="http://energy" created-on="2013-01-21T05:00:15Z"><country>Italy</country><Points><point>Callato;Cellino</point></Points></storage>
덕분에 그 작업 @damien –