• mg (7/22/2009)


    In example 10 where you delete the “city” attribute where the “team” is “SQL Server” is there any way to pass in the “SQL Server” as a variable instead of using a constant?

    Thanks,

    Marlin

    Marlin,

    You can use a variable as given in the following example

    DECLARE @x XML

    SELECT @x = '

    '

    DECLARE @Team VARCHAR(20)

    SELECT @Team = 'SQL Server'

    SET @x.modify('

    delete (Employees/Employee[@Team=sql:variable("@Team")]/@city)

    ')

    SELECT @x

    /*

    */

    .