• Another tally table solution, but this one doesn't require the creation of a separate user defined function. CTEs are used to parse the "ARRAY" into a table which can be joined to "MyOtherTable" to support your insert.

    DECLARE @input VARCHAR(2002)

    DECLARE @array VARCHAR(2000)

    DECLARE @sepchar CHAR(1)

    set @sepchar = ',' -- separation character is a comma

    set @array= '321,3AY,3LH,3PU,3PR,3SP,3JH,3VN,3VR,3VT,3VU,3VV,3VW,3VY,3UW,3WA,3WD,3WI,3WM,3WY,3WZ,3XB,3XJ,3XK'

    set @input = @sepchar + @array + @sepchar -- begin and end with separation characters

    ;WITH tally (N) as

    (SELECT TOP 1000000 row_number() OVER (ORDER BY sc1.id)

    FROM Master.dbo.SysColumns sc1

    CROSS JOIN Master.dbo.SysColumns sc2)

    ,ArrayAsTable AS

    (SELECT substring(@input,N+1,CHARindex(@sepchar,@input,N+1)-(N+1)) as element

    FROM tally

    WHERE substring(@input,N,1) = @sepchar

    and N < len(@input)

    )

    -- INSERT INTO MyTable (col1,col2,col3)

    SELECT Element

    FROM ArrayAsTable

    -- JOIN MyOtherTable ON (whatever)

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills