Link to home
Create AccountLog in
Avatar of Brad Bansner
Brad Bansner

asked on

how to add an identity column to an existing table using script

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.

Thank you!
Avatar of JestersGrind
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Brad Bansner
Brad Bansner


Works great, thanks!