• Hi guys,

    thanks a million - I checked out both methods and they both work great. I decided to go with the xml method as it means that I don't need to create ufn's or user tables in the db.

    By the way in the xml method I had to assign an alias for the returned column i.e.

    select * from (SELECT x.i.value('.', 'VARCHAR(7)')FROM @x.nodes('//i') x(i)) b

    should read

    select * from (SELECT x.i.value('.', 'VARCHAR(7)') as IDFROM @x.nodes('//i') x(i)) b

    Thanks for your help.