Home Forums SQL Server 2008 SQL Server Newbies read multiple fields with common delimited data into either a temp table or table variable without using cursors RE: read multiple fields with common delimited data into either a temp table or table variable without using cursors

  • If you want something dynamic, you will need dynamic sql code.

    Another way to do it would be concatenating the fields (up to 19 with your current length)

    select item

    from TestTable

    cross apply dbo.DelimitedSplit8K(field2 + '|' +

    field3 + '|' +

    field4 + '|' +

    field5 /*+ '|' + fieldN */, '|') f2

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2