"Daevid Vincent" <[EMAIL PROTECTED]> wrote:
> I see there is a way to DELETE or NULL a cascade, but is there a way to
> UPDATE?

ON UPDATE CASCADE, ON UPDATE SET NULL.

Look at:
        http://www.mysql.com/doc/en/InnoDB_foreign_key_constraints.html

> 
> Here's what I mean. Given these rough table schemas. I'd like to be able to
> UPDATE the company_code in the company_table, and have it update the same
> rep_company_code in the rep_table.  Ie. So a company has a certain code,
> then we change it. I want all the reps to get their codes updated too
> automagically... Is this possible now or in a future mySQL version?
> 
> CREATE TABLE company_table (
>  company_id mediumint(8) unsigned NOT NULL auto_increment,
>  company_name varchar(255) NOT NULL default '',
>  company_code varchar(15) NOT NULL default '',
>  company_referal_code varchar(15) NOT NULL default '',
>  company_phone varchar(20) NOT NULL default '',
>  company_fax varchar(20) NOT NULL default '',
>  company_url varchar(50) NOT NULL default '',
>  company_address1 varchar(70) NOT NULL default '',
>  company_address2 varchar(70) NOT NULL default '',
>  company_city varchar(50) NOT NULL default '',
>  company_state varchar(50) NOT NULL default '',
>  company_zip varchar(50) NOT NULL default '',
> ) TYPE=InnoDB;
> 
> 
> CREATE TABLE rep_table (
>  rep_id smallint(5) unsigned NOT NULL auto_increment,
>  rep_login varchar(15) NOT NULL default '',
>  rep_password varchar(15) NOT NULL default '',
>  rep_company_code varchar(15) NOT NULL default '',
>  rep_fname varchar(20) NOT NULL default '',
>  rep_lname varchar(20) NOT NULL default '',
>  rep_title varchar(50) NOT NULL default '',
> ) TYPE=InnoDB;
> 
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to