views:

196

answers:

3

I have table in a DB and the primary key is the 'TID' column, and I want to make it as AUTOINCREMENT, but I can't, because the "Identity specification" is turned off!

See this picture: http://www.rofof.com/img2/6xsbuy6.gif

How can I do it?

Thanks!

+2  A: 

You need to make it an int column or other number type rather than an nchar column. I suspect nchar(10) is the wrong type for your other columns as well: you probably want nvarchar columns for your name fields and you'll want to allow space for a little more than 10 characters.


You're trying to set a value for the ID column yourself. When you use autoincrement columns, you don't put the ID column in your insert statement at all.

Joel Coehoorn
yes, that's is! thanks. but how can I set IDENTITY_INSERT to ON? see this please: http://www.rofof.com/img2/6amojc6.gif
+1  A: 

Use a type that supports autoincrement, such as int or bigint.

Thorarin
A: 

please where are you ?

how can I set IDENTITY_INSERT to ON? see this please: rofof.com/img2/6amojc6.gif

turki2009