테이블 열의 값이있는 노드를 추가하고 싶습니다. 내 최종 결과는 내가, 내가 그것을 XQuery를 수행 할 수 있습니다하지만 난 방법의 예를 찾을 수 있다고 생각 업데이트 할 DONT이선택 쿼리에서 xml 열에 노드를 추가하십시오.
<book title="you are not alone" author="Esther">
<EDITIONS>
<edition year="2012"/>
<edition year="2013"/>
</EDITIONS>
<seller> XYZ</seller>
</book>
같이 할
declare @table table (bookid int,xmlCol xml)
insert into @table
select 1,
'<book title="you are not alone" author="Esther">
<EDITIONS>
<edition year="2012"/>
<edition year="2013"/>
</EDITIONS>
</book>'
declare @table1 table(bookid int,seller varchar(5))
insert into @table1
select 1,'xyz'
select ???
from @table t
inner join @table1 t1
on t.bookid = t1.bookid
이하 나의 예입니다 이것을하기 위해. 나는 전에 속성을 추가하는 것과 비슷한 질문을했고 Roman Pekar의 대답에 만족했습니다.
add column value to an xml field as an attribute
무엇을 시도 했습니까? 'FOR XML'을보십시오. http://technet.microsoft.com/en-us/library/ms178107.aspx – aaroncatlin