I have two sets of values:DECLARE @id1 nvarchar(max)DECLARE @id2 nvarchar(max)SELECT @id1 = '3,6,9,10,', @id2 = '56,75,87,98,'
which I need to transform into a single table variable with these values as columns, like this:@MyTableVariable----------------Col1 Col23 566 759 8710 98
Currently I have a function that transforms each nvarchar variable into its own table variable with an ID column (identity(1,1)) included. I then perform a JOIN on each table and select the results into a new table variable. It works fine, but I was wondering if there is a faster way to achieve this please?