sybase 删除触发器
最近在搞sybase移植,这便宜真是没有好货,sybase不支持级联删除,图形界面,各种支持等都跟微软差的远了,木有办法,只能上触发器了,哎~~
drop table zte_t1
drop table zte
----------------
create table zte(id int)
alter table zte
add constraint p_zte primary key (id)
------------------------------
create table zte_t1(id int,name varchar(10) null)
alter table zte_t1
add constraint P_ztetq primary key clustered(id)
create trigger trg_d_zte
on zte for delete
as
delete zte_t1 from zte_t1 n, deleted d
where n.id = d.id
go
--------------------------
insert zte values (1)
insert zte values (2)
insert zte values (3)
insert zte_t1 values(1,'aaaa1')
insert zte_t1 values(2,'aaaa2')
insert zte_t1 values(3,'aaaa3')
select * from zte
select * from zte_t1
delete from zte where id=1