I have the following table:
+--------+-----------------+
| Code | Input |
+--------+-----------------+
| 151821 | 687 235 563 |
| 123521 | 657 089 568 798 |
+--------+-----------------+
What I want to be able to do is split the "Input" string on the space character in a SQL view (which will then populate an excel query) to create something like this:
+--------+-------+
| Code | Input |
+--------+-------+
| 151821 | 687 |
| 151821 | 235 |
| 151821 | 563 |
| 123521 | 657 |
| 123521 | 089 |
| 123521 | 568 |
| 123521 | 798 |
+--------+-------+
I know I could do it at Excel level with a bit of VBA using the SPLIT
function on the spaces, but was hoping there may well be a way to do it in SQL as well.