I want to create a new column and populate the value of each row in that column with the row number.
This could be achieved in oracle by doing this.
alter table mytable add (myfield integer);
update mytable set myfield = rownum;
How would this be done in SYBASE ASE?
And now we can do things like this:
That's all. There will be a column
id
in every row that contains a unique sequence number for that row.In my case when I tried to do it with identity column time it wasn't able to finish in reasonable time (196400 rows).
Fast and easy way was to create an INT column and fill it up using a temporary variable @id incremented after each row. This solution finished in ~4 seconds.
You can find more info here: https://www.mssqltips.com/sqlservertip/1467/populate-a-sql-server-column-with-a-sequential-number-not-using-an-identity/