February 6, 2009 at 6:43 am
Hi,
I want to add a identity column to a already existing column in a table which has some unique numbers in it. It is possible through enterprise manager but i want to generate a script to send to my client so that he just runs it and identity is added to the column and there is no data loss. I tried using Alter table but it didnt work. Please let me know if anyone has done this.
Thanks,
polaiah
February 6, 2009 at 7:30 am
You can script things in Enterprise Manager.
Edit the table, then rather than saving it, click the generate script button.
February 6, 2009 at 7:44 am
Are you trying to turn an existing column into an identity, or to add an identity column (new column) to a table?
Adding one is easy:
alter table dbo.MyTable
add ID int identity;
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply