SQL Server Performance

use of sql:column in XQUERY

Discussion in 'SQL Server 2005 General Developer Questions' started by jagblue, Feb 1, 2008.

  1. jagblue New Member

    Hi all
    I tried forllowing XQuery and it's working fine
    DECLARE
    @Name nvarchar(100)SELECT
    @Name = 'Calvin'DECLARE @xmldoc xmlSET @xmldoc = '<Root>
    <Employee EmployeeID="1">
    <EmployeeInformation>
    <FirstName>Scott</FirstName>
    </EmployeeInformation>
    </Employee>
    </Root>'SELECT
    @xmldocSELECT
    Employee.col.value('FirstName[1]','VARCHAR(100)') AS FirstNameFROM
    @xmldoc.nodes('/Root/Employee/EmployeeInformation') Employee(col)SET @xmldoc.modify('replace value of (/Root/Employee/EmployeeInformation/FirstName/text())[1]
    with sql:variable("@Name")'
    )SELECT
    @xmldoc
    Now I wants to use sql:column() in staid of sql:veriable()
    something like thisSET @xmldoc.modify('replace value of (/Root/Employee/EmployeeInformation/FirstName/text())[1]
    with sql:column("pc.FirstName")'
    )FROM
    Person.Contact
    WHERE ContactID =1SELECT
    @xmldoc
    This gives me error
    Any help please
    Thank You
  2. satya Moderator

  3. jagblue New Member

    Thanks satya for replay
    So if I wants to update XML I need to have it to store it some SQL Table
    Also is their any way i can Update multipal nodes of XML using in one commnd?
    Thanks
  4. satya Moderator

Share This Page