Splitting column to as many columns as needed by delimiter

We'll need to see some sample data, plus example results you'd want to see from that data. Preferably as INSERT statements like:

CREATE TABLE test(test_column varchar(100) not null);
INSERT test(test_column) VALUES('First|Second|Third')
,('Fourth|Fifth|Sixth|Seventh')

Regarding "split[ting] into as many new columns as needed", that will be tricky to do in SQL, as it's intended to have explicitly specified column names, not dynamic ones. You can split this into a dynamic number of rows, and then use a PIVOT or other cross-tab technique to create column names and then put the relevant values in them

There's some techniques listed in this thread that will give you some ideas:

Until there's some examples to work with though, I can't say if that will work for you or not.

1 Like