February 3, 2009 at 1:55 pm
Hey everyone.
Here is an interesting one. How would you go about altering the increment value of an identity column and have it affect all prior data with the new increment value?
So you have the following
Col1 (identity column)
1
2
3
4
and it should be replace
col1
1
4
7
10
Thanks,
Fraggle
February 3, 2009 at 2:28 pm
I would create another, identical table with the new identity increment value, insert into it from the original table, drop the original table and rename the new one.
Greg
February 3, 2009 at 2:34 pm
There is no direct way to do this.
If you must physically re-align the identity values rebuild the table as suggested above.
if you just need the values to be incremental on a query, take a look at the new row_Number() function, or Rank() Functions
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply