0

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!

Svante
  • 50,694
  • 11
  • 78
  • 122

2 Answers2

2

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
  • 399,467
  • 113
  • 570
  • 794
  • yes, that's is! thanks. but how can I set IDENTITY_INSERT to ON? see this please: http://www.rofof.com/img2/6amojc6.gif –  Jun 06 '09 at 13:58
1

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

Thorarin
  • 47,289
  • 11
  • 75
  • 111