![]() ![]() Once again, the order of CSV values is meaningful for the subsequent manipulations. Basically I want to split CSV values in each of the columns without multiplying the number of records every time I do the split, but just to append them to the same id. Select t.id, t.kpi1, t.kpi2, t.kpi3, ca1.items as items1, ca2.items as items2 However, as soon as I try to add a second column to the mix, I get a cross-join, which is incorrect: Select t.id, t.kpi1, t.kpi2, t.kpi3, ca1.items as items1 I tried using CROSS APPLY first and it works fine for one column: Returns TABLE (id int, items varchar(128)) Here is the definition:ĬREATE FUNCTION dbo.fnETL_Split_Set_CSV_To_Table char(1) I do have a function which converts CSV values into rows (I think I got it from this site). The order of the CSV values is meaningful (explained more below) Here is the sample DDL:ĬREATE TABLE #t (id int, kpi1 varchar(16), kpi2 varchar(16), kpi3 varchar(16)) I have a table with three columns containing CSV values.
0 Comments
Leave a Reply. |