简体   繁体   中英

Do I need an identity column on my ms-sql table?

I have a table that holds id's from other tables and by default (as I do from years of habit) I made an identity column as a primary key on this archive table.

Now I want to reseed it so that the table uses different numbers as keys, taken from the tables that are dumped into it every so often.

I'm thinking about taking the Identity property off the column and updating the values to my new numbering scheme.

Am I doing the right thing design wise? I just don't see a need for an identity on an archive table if I use another int key.

Using an identity on a primary key column is convenient. If you have other ways of upholding a primary key that is ok if not even preferable.

That's ok. I'm just now reading a book by Joe Celko's
Sql for Smarties, Advanced Sql Progrmming

He goes in the same direction and votes against identity columns in his book (p.36ff)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM