Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 dynamic xml insertion in sql 2005

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-30 : 08:52:01
James Agnew writes "Hello all

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"
   

- Advertisement -