I donβt think you can do it in one step, but you can do it in two steps if you are on SQL Server 2008:
DECLARE @NewValue NVARCHAR(50) SELECT @NewValue = [xml].value('(//TAG2)[1]', 'NVARCHAR(50)') FROM dbo.v1 WHERE id = 1 UPDATE dbo.v2 SET [xml].modify('replace value of (//TAG1/text())[1] with sql:variable("@NewValue")') WHERE id = 1
The ability to specify sql:variable in replace value of XQuery is a new feature in SQL Server 2008, so if you are stuck in 2005, unfortunately, this will not work.
marc_s
source share