Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 foreign key relationship in ms sql server05

Author  Topic 

jonekim
Starting Member

35 Posts

Posted - 2011-09-19 : 21:53:15
When creating foreign key relationship, a window appears with different options such as:
1. general
check existing data on creation or re-enabling: yes
2. table designer
enforce for replication
enforce foreign key constraints
3. insert and update specifications
delete rule
no action
cascade
set null
set default
update rule
no action
cascade
set null
set default
What are this options, what is the meaning of these options? How to use them properly and when to use them?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 03:03:31
1. this option is used to indicate whether it has to do referential integrity check on creation of fk. if yes, it will throw an error if it finds a value in fk field which is not in reffered field. if no, it ignores this check
2. this ias asking whether we need to enforce fk during replication to other dbs
3. this are actions to take on child table when an action is done on parent
like what to do when parent record is deleted, when parent field value is deleted etc
based on setting it may either delete fk record altogether or do update to reflect changed value or set it to null/default values

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -