Are cascade updates neccessary when all your foreign keys are autonumbers?

xwnoob

Registered User.
Local time
Today, 14:15
Joined
Nov 7, 2011
Messages
70
Hi,

Even if your foreign keys are all autonumbers, it doesnt matter if you tick or do not tick the cascade update amiright? Since its not advised to change autonumbers/primary keys. I only know that its neccessary to tick the cascade delete so that you are able to delete the related records.
 
Your foreign keys should not be autonumbers. Your Primary keys should and, in answer to your question, if you have an autonumber primary key then cascade updates are irrelevant.
 
Your foreign keys should not be autonumbers. Your Primary keys should and, in answer to your question, if you have an autonumber primary key then cascade updates are irrelevant.

SOrry i said it wrongly yea my foreign keys are numbers.. and the datatype is set to the same as the autonumber
 
personally, i would NEVER use cascading updates or deletes

firstly, cascading updates implies that a PK has changed, requiring the same values in linked tables to be changed. I would tend to use an autonumber key, that would never require changing. BUt if you choose a different key to an autonumber, it should be something that would never change (ef, like a two-letterus state value)

secondly, cascading deletes involves deleting data that has probably taken a long while to capture. I would generally prefer to set a "dead data" flag, and keep the data - but even if I DID want to delete the linked data, I would probably do it manually (ie via code, but under my control) rather than automatically
 

Users who are viewing this thread

Back
Top Bottom