Add a column to existing table and uniquely number them on MS SQL Server
sql, sql-server
Solution
This will depend on the database but for SQL Server, this could be achieved as follows:
alter table Example
add NewColumn int identity(1,1)
Problem
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?