I want to add a column to an existing legacy database and write a procedure by which I can assign each record a different value. Something like adding a column and autogenerate the data for it.
Like, if I add a new column called ‘ID’ (number) I want to then initialize a unique value to each of the records. So, my ID column will have records from say 1 to 1000.
How do I do that?
This will depend on the database but for SQL Server, this could be achieved as follows: