1

I want do SQL query of alter to change column int type from normal to identity with seed 10 and start 5

how I do that?

I mean something like:

 ALTER TABLE Persons MODIFY ID Identity(5,10)

 ALTER TABLE Table3 ALTER COLUMN AutoINC set  Idenity(5,2)

to change he's identity

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Asaf Shazar
  • 1,023
  • 10
  • 29

2 Answers2

4

You can't alter the existing identity column. You have to create new column for that.

ALTER TABLE Persons
ADD NewIdColumn int IDENTITY (5, 10);

Or as you want to put the same name then you can drop the existing column (make sure about your data loss) and then add it again with above statement.

Sachin
  • 39,043
  • 7
  • 86
  • 102
2

You can't alter existing column as identity column

This link provides the options

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/04d69ee6-d4f5-4f8f-a115-d89f7bcbc032/how-to-alter-column-to-identity11?forum=transactsql

radar
  • 13,100
  • 2
  • 23
  • 32