1
我試圖插入XML轉換爲SQL Server表,但我得到一個錯誤:導入XML到SQL Server
Msg 2205, Level 16, State 1, Line 10
XQuery [value()]: ")" was expected.
代碼:
DECLARE @XML XML = '<list>
<object Index="0" Type="0" Name="obj1" Level="6" />
<object Index="1" Type="0" Name="obj2" Level="9" />
</list>'
INSERT INTO dbo.testt(test1, test2, test3, test4)
SELECT
test1 = Events.value('@Index','int'),
test2 = Events.value('@Type','varchar'),
test3 =Events.value('@Name','varchar'),
test4 =Events.value('(@Level','int')
FROM
@XML.nodes('/list/object') AS testtt(Events)
謝謝!
媽....非常感謝你! :) – MeTa 2015-03-31 14:01:39