Reputation: 33
There are lots of answers for adding a column to a table with some increment; e.g. start at 1 and increment by 1; e.g. 1, 2, 3 etc.
I need to add a column to tables that starts at 1, and increments by 1, but each number is repeated some number of times before the next number in the sequence.
For example: 100 rows of 1, then 100 rows of 2, etc. until the end of the table.
Upvotes: 0
Views: 1198
Reputation: 27224
Options based on what you have said:
row_number() over ()/100
identity
column and then create a computed column which is your identity column divided by 100 using integer division.int
column and run a manual update on it using row_number() over ()/100
.Upvotes: 3