Re: How can I replace a value in xml with .modify from the variable?



Thanks Kent,

I also could not find any better way.
the answer using sp_executesql is:

DECLARE @SQL nvarchar(max)

SET @SQL =

'SET @xml.modify(''replace value of (/Tasks/row/@ConversationHandle)[1] with
"' + cast(@ConversationHandle as char(36)) + '"'');'

SELECT @sql

EXEC sp_executesql

@stmt = @sql

,@params = N'@xml xml OUTPUT'

,@xml = @xml1 OUTPUT

select @xml1


"Kent Tegels" <ktegels@xxxxxxxxxxx> wrote in message
news:b87ad741397a8c8d18706916da0@xxxxxxxxxxxxxxxxxxxxx
Hello Farmer,

Off the top of my head, sp_sqlexcutesql is the only was to do this as the
constructor isn't availble in XQuery DML for SQL Server 2005.

Thanks,
Kent Tegels
http://staff.develop.com/ktegels/




.



Relevant Pages

  • Re: Is there a way to convert ms sql 2008 tables to XML files?
    ... After looking at the code I made it work, since I removed 2 nVARCHARcolumns from the SQL statement where it is used as an RTF. ... I have the 2 XML files the bad and the good which are below: ... Verdana;}{\f1\fnil\fcharset0 Microsoft Sans ... Here is the actual string copied from the ms sql 2008 which works fine; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: XML-Speicherung beim SQL Server 2005
    ... > also wenn die XML-Dokumente geparst werden, ... das der SQL Server dafür XQuery einsetzt. ... Struktur von XML. ...
    (microsoft.public.de.sqlserver)
  • Possible?? SQL Svr obtaining data via SOAP/XML from another SQL Sv
    ... SQL servers (one local, one remote through the internet). ... I used VBScript, MSXML, MSSOAP to connect, query, parse and insert data into ... XML" functionality provided in SELECT verb. ...
    (microsoft.public.sqlserver.xml)
  • Re: Implementation of boolean types.
    ... >> Marshall Spight wrote: ... I think of SQL as bringing the 3VL into popularity, ... world and XML will surely play I roll. ... XML doesn't address data management; ...
    (comp.databases.theory)
  • RE: Data Insertion
    ... Ilya ... fix for loading XML into the DataSet. ... > Are there any benchmarks for data insertion with SQL CE and ADO.net? ... Load ~1 MB XML file into the DataSet with schema preloaded (3 nested ...
    (microsoft.public.dotnet.framework.compactframework)

Loading