• i've been having a bit more of a play with this and have noticed that the line

    OriginalSchema.value('Form[1]/Codes[1]/code[sql:column("y.myNum")][1]','varchar(max)')

    is significationly slowing down my query.

    each row in the table that houses the XML column is assigned to a Client.

    A Client could have any number of rows.

    It seems that the more rows there are, the slower it becomes - significantly.

    One such Client has 8 rows. each row has an XML column with 400 'code', which i am referencing in the code line above, in this post.

    That means it is 'cycling' through 3200 'code' (400 X 8).

    with the above line in, it takes 6 seconds. without, it takes less than 1.

    i'm wondering if there is a more efficient way of getting the same result?