I have a table that looks like this:
Table 1
+----+--------+----------+
| ID | Name | SIZE |
+----+--------+----------+
| 1 | Style1 | S,M,L,XL |
+----+--------+----------+
I need to iterate through the whole table and load it into another table that looks like the following without using SPLIT_STRING
, we are using SQL Server 2012 without that capability.
I also know that the max values that would be inserted into the new table would be 100 columns wide. I'm still new to SQL and not very comfortable with functions and how to utilize them.
Table 2
+----+--------+-------+-------+-------+-------+-----+-------+
| ID | NAME | SIZE1 | SIZE2 | SIZE3 | SIZE4 | ... | SIZEN |
+----+--------+-------+-------+-------+-------+-----+-------+
| 1 | Style1 | S | M | L | XL | | |
+----+--------+-------+-------+-------+-------+-----+-------+
Thank you