vbnetcoder
asked on
i have a primary key field -- but how do i update the field so that it is is an identity column that increments by one every time something is inserted
i have a primary key field -- but how do i update the field so that it is is an identity column that increments by one every time something is inserted.
It is an existing table so i believe I have to use alter table but not sure of all the syntax
It is an existing table so i believe I have to use alter table but not sure of all the syntax
You want to update an identity column? Be careful with updating a primary key column since it can affect the referential integrity. You'll need first to disable the constraint before updating the field.
ASKER
This is a test database so not a huge deal
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Assuming this would work you could change a column to identity only if its data type is int/bigint however I think the SSMS change will not work and it will generate an error when you will hit the save button.
ASKER
ty