jamesagnew
Programmer
Hi
I'm trying to insert an xml node containing a dynamically generated value in SQL Server 2005.
Here's what I've got so far:
declare @x nvarchar(100)
set @x = 'abc123'
UPDATE tbl_tree
SET theTree.modify('replace value of (/tree[1]/branch[1]/@name) with @x')
This doesn't work of course because it expects "" around the value that is being added (@x)
I've tried creating a string such as
@str='replace value of (/tree[1]/branch[1]/@name) with "'+@x + '"'
and EXEC() it but that still doesn't work.
Any ideas?
Thanks, James
I'm trying to insert an xml node containing a dynamically generated value in SQL Server 2005.
Here's what I've got so far:
declare @x nvarchar(100)
set @x = 'abc123'
UPDATE tbl_tree
SET theTree.modify('replace value of (/tree[1]/branch[1]/@name) with @x')
This doesn't work of course because it expects "" around the value that is being added (@x)
I've tried creating a string such as
@str='replace value of (/tree[1]/branch[1]/@name) with "'+@x + '"'
and EXEC() it but that still doesn't work.
Any ideas?
Thanks, James