SQL Server Performance

Identity Field

Discussion in 'General DBA Questions' started by fauzanf, Dec 16, 2009.

  1. fauzanf New Member

    Hello My Friends,
    I have a field with data type is INT (YES NOT FOR REPLICATION). This field is PrimaryKey.
    Right now, it almost the end of the year. Is it possible to reset the value from the beginning...? I guess no, because this field is primarykey.
    I really need an advice please.
    Thank you.
  2. FrankKalis Moderator

    While it is possible to reset the value for an IDENTITY column with DBCC CHECKIDENT, in your case it is very likely that you sooner or later will get PRIMARY KEY violations. IDENTITY columns as PRIMARY KEYs are perfectly fine as long as you don't put any meaning to the generated value. They are just a convenient way to uniquely identify each row. If the value however does have a meaning for you, you may want to remove the IDENTITY property and use your own logic to maintain these values. But from what I guess this looks like a significant redesign.
  3. Madhivanan Moderator

    or create a new column of datatype DATETIME that has default value of current date
    Set both columns as Primary keys

Share This Page