• DECLARE @index int

    SET @index = 0

    DECLARE @charCount as varchar(1)

    DECLARE @count int

    SET @charcount = CAST(@CustomerData.query('count(/customer/customer)') as varchar)

    SET @Count = CAST(@charCount as int)

    WHILE @index < @count

    BEGIN

    DECLARE @ID2 uniqueidentifier

    SET @ID2 = NewID()

    SET @CustomerData.modify('insert element ID {"x"} before

    (/customer/customer/firstName)[sql:variable("@index")]')

    SET @CustomerData.modify('replace value of (/customer/customer/ID/text())[sql:variable("@index")] with sql:variable("@ID2")')

    SET @index = @index + 1

    END

    Instead of sql:variable("@index") if I use 1 or 2 its working..my question how to get the parameterized index