I dumped my source query into a temporary table which contained an identity column.
Declare @X table (
ID Int identity(1,1)
, HistoryID Int
, DueDate Date
, Number Varchar(255)
, UniqueXML xml
)
I then used a while loop to temporarily store the data I want to change
Declare @m, @I as int
Select @m = Count(*), @I = 1 from @x
While @I <= @m
Begin
Declare @DueDate Date
Select @DueDate = Duedate from @x where ID = @I
if @Date is not null
Begin
Update @x
Set UniqueXML.modify('
replace value of (/Date/text())[1]
with sql:variable("@Date")')
Where ID = @i
End
End
It's not a simple solution, but it works for my needs.