• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

SQL Server Management Studio- setiing an Identity

I've created a table but want to add an identity column to it.
How is this done through the management studio? (SQL Server 2008)
(The Identity specification is disabled and set to No for all columns).
Cheers
0
Spike_66
Asked:
Spike_66
1 Solution
 
sammySeltzerCommented:
ALTER TABLE YourTable ALTER COLUMN Id IDENTITY (200,1)


0
 
sammySeltzerCommented:
above assumes that the colum already exists.

If that isn't the case, then this will add a column and make it identity seed:

alter table yourTable
add  id int not null Identity(1,1)
0
 
mribasuCommented:
add any column int data type and then you can find indentity specification enbled but for varchar/bit  type column you can not find identity specification enble.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mkobrinCommented:
If the column you want to use already has data in it you will not be able to use it as an Identity column, you will need to create a new column, and it will have to be an int column and it may not allow nulls.
0
 
Spike_66Author Commented:
Worked- although how do you do it through the table design properties?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you cannot ALTER a column to change from non-identity to identity.

you have to drop and recreate the column for that.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now