Is there a general way to replace referential constraints with triggers?

Transferring the application from MSSQL + Oracle to Sybase, and there is a problem with 'on delete cascade' - Sybase has no option.

Sybase has a link with a trigger for implementing cascading deletion: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/html/sqlug/sqlug815.htm but there is the problem with this solution is when it is used in the context of using it as "to remove the cascade."

Problem, triggers are executed after checking all link constraints. The problem is illustrated here:

--drop table A
--drop table B
create table A (c int primary key)
create table B (c int primary key)

alter table A
add constraint Ac FOREIGN KEY (c) REFERENCES B(c)

create trigger delBA on B for delete 
as delete A from A, deleted where A.c = deleted.c

insert into B values (1)
insert into A values (1)

delete B where c = 1

'delete' - 'Ac'. ( ), "1" "A", .

. , Insert Update. - , ?

, , , , , , . - , .

+3
1

. , , "" ( ), .

+1

All Articles