Suppose I have 5 columns which contain a value of either an ‘A’ or ’B’
+------+------+------+------+------+
| Col1 | Col2 | Col3 | Col4 | Col5 |
+------+------+------+------+------+
| A | A | B | A | B |
| B | A | B | B | A |
+------+------+------+------+------+
I also want to assign those 5 columns to have an ID number of 1 to 5
+----+---------+
| ID | Columns |
+----+---------+
| 1 | Col1 |
| 2 | Col2 |
| 3 | Col3 |
| 4 | Col4 |
| 5 | Col5 |
+----+---------+
What I would like to do is insert a new row(s) into a db table if col1, col2, col4 in the first row contains an 'A' in which case 3 new rows will be inserted each containing their respective ID number.
The table that I'm inserting into should look something like this
+----+----------+----------+----------+----------+
| ID | SomeCol0 | SomeCol1 | SomeCol2 | SomeCol3 |
+----+----------+----------+----------+----------+
| 1 | x | x | x | x |
| 2 | x | x | x | x |
| 4 | x | x | x | x |
+----+----------+----------+----------+----------+
This is for a VB.NET application. I would prefer to have this logic work out in TSQL but VB code can do as well. I’m really at a loss on what to do. Any help is greatly appreciated.