Search code examples
typesidentifier

What data type do you use for storing IDs?


Why is there a minimum character count for posting questions? o.O

Do you use int, bigint, tinyint, whatever?

It seems like a small thing I guess, I was just wondering what the usual practice is


Solution

  • It all depends ... my favorite answer to a question! =)

    Most of the time we use Guids. While they are larger, size-wise, than int, tinyint and so on, I like the fact that my business objects can know what the value is before inserting records into the database.

    At other times I may use strings, for things like customer id, where it might need to be easily recognized when working with the database.