• Hey Todd

    Re: splitting a string to a table variable "array" - give this a try:

    DECLARE @values TABLE (value VARCHAR(10))

    DECLARE @xml AS XML,@str AS VARCHAR(100),@delimiter AS VARCHAR(10)

    SET @STR='A,B,C,D,E'

    SET @delimiter =','

    SET @xml = CAST(('<X>'+REPLACE(@str,@delimiter ,'</X><X>')+'</X>') AS XML)

    INSERT INTO @values (value)

    SELECT N.value('.', 'varchar(10)') AS value FROM @xml.nodes('X') as T(N)

    SELECT * FROM @values

    Cheers,

    Ken

    PS I can't claim to have come up with this - I found it somewhere on the net.