Home     All Posts     RSS Feed     Search     Contact

Newest Articles
Canon Wireless
Talking Smoke Detectors
Fire Safety House
Garage Security
Low Profile Window Air Conditioner
Ceiling Mounted Pir
Liquid Soap Products
Hydrogen Leak Detector

Network
The Furniture Blog
Furniture Blog
Home Blogging
Homes Blogs
Furniture Solve
Furnitures DB
Corp Homes
Furniture Shoppe
Furniture Shopping
Home Shoppe
Home Shopping Store

Marketplace

Sybase Alter

Posted on January 5, 2012.
Sybase AlterMS-SQL: How do I change an existing column having an autoincrement defaulta

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

if I'm using Sybase I can simply write
Alter table modify TheTable thefield default autoincrement

But how can I do in MSSQLa

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 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 it. Do it on a copy of the db first and test before hitting your real db.

Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 9351.