how to add an identity column to an existing table using script
Posted on 2011-10-05
I have an existing ASP script which generates a new table, by doing a CREATE TABLE statement, a bunch of columns, then at the end:
lm_index INT IDENTITY (1, 1) NOT NULL
...which creates an integer column called lm_index, as an identity column, auto-increment beginning with 1. Works great.
However, now I have a need to add this same exact type of column to an existing table. Can that be done just as easily?
Sorry if this is a very basic question, but I need to do this the right way the first time, and building/altering tables via a script is not something I do very often.