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 2005 Forums
 Transact-SQL (2005)
 Xquery modify question

Author  Topic 

Trojka
Starting Member

10 Posts

Posted - 2007-10-03 : 07:16:15
Is there a way to combine these two update queries? They do more or less the same, the only difference is the element they're updating.

UPDATE cim.dbo.wachtrij
SET actiexml.modify('
replace value of (KoppelingAutomaatContract/Beeindiging/InvoerIngangsDatumWijziging/text())[1]
with "2007-09-17T00:00:00" ' )

UPDATE cim.dbo.wachtrij
SET actiexml.modify('
replace value of (KoppelingAutomaatContract/Beeindiging/Naam/text())[1]
with "Modified by AM" ' )

I've tried doing it the 'normal' way (interpreting the modify statements as regular columns), like this:

UPDATE cim.dbo.wachtrij
SET actiexml.modify('
replace value of (KoppelingAutomaatContract/Beeindiging/InvoerIngangsDatumWijziging/text())[1]
with "2007-09-17T00:00:00" ' ),
actiexml.modify('
replace value of (KoppelingAutomaatContract/Beeindiging/Naam/text())[1]
with "Modified by AM" ' )

But this results into the following error:

Column name 'ActieXml' appears more than once in the result column list.
   

- Advertisement -