views:

121

answers:

3

Hi every one Nice job! Using of Sql Express Management Studio 2008 GUI(not with coding),how can I make a primary key auto-incremented? Let me explain,there is a table which has a column named "id" and the items of this column are set to be primary keys. I want to make this column auto-incremented,but how? Cheers

+2  A: 

Presumably you are in the design of the table (right click table name - design).

Click the required column.

In column properties at the bottom, there is identity specification expand it, then toggle is identity to yes

Chris Diver
+1  A: 

Right-click on the table in SSMS, 'Design' it, and click on the id column. In the properties, set the identity to be seeded @ e.g. 1 and to have increment of 1 - save and you're done.

Will A
"identity" and ""identity seed" are disabled.how can i enable them?
Saeidmscs
As per other responses, you'll need to mark the column as being an identity column beforehand - set `is identity` to 'yes'
Will A
+1  A: 

I don't have Express Management Studio on this machine, so I'm going based on memory. I think you need to set the column as "IDENTITY", and there should be a [+] under properties where you can expand, and set auto-increment to true.

Cambium