1
我正在嘗試使用xml更新表。在SQL Server中使用XML更新
UPDATE dbo.M_Picture
SET Sequence = T.c.query('Sequence')
FROM dbo.M_Picture pic
INNER JOIN @xml.nodes('/pictures/picture') T(c)
ON pic.PictureId = T.c.query('pictureId') --I guess issue is in this line
我使用的XML是
<pictures>
<picture>
<pictureId>30</pictureId>
<Sequence>4</Sequence>
</picture>
<picture>
<pictureId>31</pictureId>
<Sequence>4</Sequence>
</picture>
</pictures>
我得到的錯誤信息是
操作數類型衝突:XML是與詮釋
它不兼容有道理,因爲在
pic.PictureId=T.c.query('pictureId')
pictureId
是int
如何排序了這一點?