Home     Archive     Subscribe     Contact Search

Popular Articles
Trane Electric Furnace
Small Air Conditioner
Mercruiser Thermostat
Amish Fireplace
Heater Thermostat
General Electric Air Conditioners
Frigidaire Stackable Washer Dryer
Splendide Washer Dryer

Other Blogs
Media Grids
Owners Mortgage
Real Estate Bar
Property Banter
Fitness Vine
Sport Excite
Dash Sport
Sport Gal
The Sp-ort Network
Sport Diaries
Travel Chop
Travel Junctions

Marketplace

Sybase Alter

Sybase AlterMS-SQL: How do I change an existing column having an autoincrement default?

I have an existing database, and a table I have a whole field is the identifier.
I would like to change this field in a field auto-incremental. I must not change the values that are already present, but I want to start counting a number greater than the highest value today.

if I'm using Sybase I can simply write
ALTER TABLE change TheTable thefield default autoincrement

But how can I do in MSSQL?

You can not in MSSQL.

You must either create a new table, copy data, delete the old table and rename the new.
Or create a new column, copy the data, delete the existing column and rename the new.

More difficult if you have constraints on the table / column.

Make sure you know what you are doing before trying this. Do it on a copy of the comic first and test before hitting your DB Real.

Posted on August 3, 2010.
Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 7482.