Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kneel
Starting Member
36 Posts |
Posted - 2008-05-02 : 02:31:39
|
| HELLO All,Does anybody knows how to set identity to column using ALTER Script.Thanks in advance.--kneel |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-02 : 02:37:12
|
| You cant set identity to a column using alter script directly. However you can achieve this by doing following steps:-1.add a new column and make it identity2. migrate the data from your existing column to this after setting identity insert to on 3. drop the existing foreign key,indexes,constraints on original column.4. drop the original column 5. rename new column as original column using sp_rename6. recreate all constraints,indexes on new column7. set identity insert back to off |
 |
|
|
|
|
|