Update Rules in SQL – SQL Server Tutorial

UPDATE RULES  :-

The different update rules are

  • On  update no action
  • On update cascade
  • On update set null
  • On update set default

The update rules specifies how child record is effected if primary key of the parent record is updated.

(i) on update no action :-

  • Parent can’t be updated it matching child record exists.

(ii) on update cascade :-

  • If the foreign key is declared with or update cascade then if primary key is updated matching foreign key also is updated automatically.

(iii) on update set null :-

  • The foreign key declared with on update set null then if primary key is updated the matching foreign key value set to null.

(iv) on update set default :-

  • If primery key is updated do matching foreign key value set to default value

Leave a Reply

Your email address will not be published. Required fields are marked *