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!
Microsoft SQL Server

Avatar of undefined
Last Comment
Brad Bansner

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
JestersGrind

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Brad Bansner

ASKER
Works great, thanks!
Your help has saved me hundreds of hours of internet surfing.
fblack61