Board index » delphi » MSSQL: Cascade Updating a Primary Key on Foreign Tables

MSSQL: Cascade Updating a Primary Key on Foreign Tables

Hi,

I have a table Table1 with fields:
  Create Table Table1(
    Cod1 numeric(5) not null,
    Name1 varchar(50),
    Primary Key(Cod1));
Then, Cod1 is a foreign key on:
  Create Table Table2(
    Cod2 numeric(5) not null,
    Name2 varchar(50),
    Cod1 numeric(5) not null,
    Primary Key(Cod2),
    Foreign Key(Cod1));

I would like to update Cod1 on
Table1 and, automatically, update
Cod1 on Table2. Is this possible
on SQL Server 6.5 ?

Or I have to disable temporarily
the constraint Foreign Key, update
Table1, update Table2, and enable
the constraint again ?

  vcard.vcf
< 1K Download
 

Re:MSSQL: Cascade Updating a Primary Key on Foreign Tables


SQL Server 6.5 doesn't support CASCADE on updates or deletes.

So you should use triggers and program it yourself.

Greets,

Rogier

Other Threads