Auto-generated values for columns in database

Posted by Jamal on Stack Overflow See other posts from Stack Overflow or by Jamal
Published on 2010-03-09T05:51:58Z Indexed on 2010/03/09 6:06 UTC
Read the original article Hit count: 230

Is it a good practice to initialize columns that we can know their values in database, for example identity columns of type unique identifier can have a default value (NEWID()), or columns that shows the record create date can have a default value (GETDATE()).

Should I go through all my tables and do this whereever I am sure that I won't need to assign the value manually and the Auto-generated value is correct.

I am also thinking about using linq-to-sql classes and setting the "Auto Generated Value" property of these columns to true.

Maybe this is what everybody already knows or maybe I am asking a question about a fundamental issue, if so please tell me.

© Stack Overflow or respective owner

Related posts about database-design

Related posts about linq-to-sql