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
  • 732,580
  • 175
  • 1,330
  • 1,459
Asaf Shazar
  • 1,065
  • 1
  • 11
  • 33

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
  • 40,216
  • 7
  • 90
  • 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,270
  • 2
  • 25
  • 33