I've searched the posts and library. Associates have different ideas on the topic. So what is your opinion?
For SQL 2005, what is the recommended data type for a primary key?
Hi,
tihs is normally not a thing of best practice. I am always a friend of using natural Primary Keys rather than artifical produced keys. Uniqueidentifiet is normally NOT a natural key.
Using GUIDs or not is a religious question, which I decided for me is a worse practice, because storing GUID is often more expensive than storing natural keys. Primary keys should always be designed to use the less amount of data that joining will not be expensive. If you have no natural key, I am always a friend of using integer value (differnent scale based on the requirement, e.g. for a table of male/female you won′t need a bigint, though there won′t be much more genders)
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||Unless you need a guid for a reason(networked based uniqueness) then I suggest using an Integer with the identity attribute, this will autogenerate keys like autonumber does in access. THis assumes of course that you can not follow Jens advice of finding a natural key.
No comments:
Post a Comment