I am working with T-SQL and I have a table that looks like Matrix (8x8). My objective is to make that Matrix (table) into array using Pivot ... I have read forums and more stuff that i managed to find but i still can't make a code for it ...

```
ID Bucket B1 B2 B3 B4
5 1 20 21 45 12
6 2 12 18 19 48
7 3 19 78 40 78
8 4 72 34 12 17
```

So all I need to do is to make "three dimensional array" from that table, and to save row, column and value ... to be something like this

```
Row Column Value
1 1 20
1 2 21
1 3 45
1 2 12
etc
etc
etc
4 3 12
4 4 17
```

Does anyone have any idea how I could write that code in T-SQL?

ps. Reason i'm doing this, is because i want to multiply my matrix with itself. So it's easier to multiply it if i have it in pivot table. Thank you