Table in DB for generating primary keys?

Posted by Sapphire on Stack Overflow See other posts from Stack Overflow or by Sapphire
Published on 2010-03-12T18:41:43Z Indexed on 2010/03/12 18:47 UTC
Read the original article Hit count: 181

Do you ever use a separate table for "generating" artificial primary keys for DB (and why)? What I mean is to have a table with two columns, table name and current ID - with which you could get new "ID" for some table by simply locking the row with that table name, getting the current value of the key, increment it by one, and unlock the row. Why would you prefer this over standard integer identity column?

P.S. The "idea" is from Fowlers Patterns of Enterprise Application Architecture, btw...

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about database