Index Columns Text New Index
===========================================
1 ISOCountry TH 1
-------------------------------------------
2 Country Thailand 1
-------------------------------------------
3 Region Asia 1
-------------------------------------------
4 Date 12/31/2014 1
-------------------------------------------
5 Holiday New Years Eve 1
-------------------------------------------
7 ISOCountry DE 2
-------------------------------------------
8 Country Germany 2
-------------------------------------------
9 Region EMEA 2
-------------------------------------------
10 Date 12/31/2014 2
-------------------------------------------
11 Holiday New Years Eve 2
-------------------------------------------
13 ISOCountry DK 3
-------------------------------------------
14 Country Denmark 3
-------------------------------------------
15 Region EMEA 3
-------------------------------------------
16 Date 12/31/2014 3
-------------------------------------------
17 Holiday New Years Eve 3
-------------------------------------------
I have a column as above. I need a loop/cursor in SQL Server such that everytime the Column "Column" changes to ISOCountry, the New Index column has to be incremented by 1. Which means that for Rows 1 through 5 the New Index column has a value 1, for rows 7 through 11 the New Index value has to be 2 and so on. The point where the Columns changes to ISO Country the New Index Value has to change to 2 likewise for the rest of the columns. I will have about 10000 rows in all
Any help in this regard will be greatly appreciated. Thanks