The target of 'replace' must be at most one node, found 'attribute(selectedSum,xdt:untypedAtomic) *'
Выкручиваемся так, в цикле для каждой строки
declare @iCount int; set @iCount = ( select xmlData.value('count(//*)', 'int') from [Metrolog].[dbo].[m_PWStatus] where deleted is null and pfId=12 and statusId=2 ); declare @i int; set @i = 1; declare @repl varchar(30) = '2890659.320'; while (@i <= @iCount) begin update [Metrolog].[dbo].[m_PWStatus] set xmlData.modify('declare namespace ttt="urn:metrolog.fsk-ees.ru"; replace value of (/rows/ttt:row[sql:variable("@i")]/@selectedSum)[1] with sql:variable("@repl")') where deleted is null and pfId=12 and statusId=2; update [Metrolog].[dbo].[m_PWStatus] set xmlData.modify('declare namespace ttt="urn:metrolog.fsk-ees.ru"; replace value of (/rows/ttt:row[sql:variable("@i")]/@selectedCnt)[1] with "250"') where deleted is null and pfId=12 and statusId=2; set @i = @i + 1; end