Skip to content

Instantly share code, notes, and snippets.

//utils.sql
use BookStore;
drop procedure if exists drop_fk;
create procedure drop_fk(
in tb_name varchar(30),
in fk_name varchar(30)
)begin
if exists(select true from information_schema.table_constraints
where table_schema = 'BookStore' and table_name = tb_name
--2. Bình luận của một sản phẩm chỉ được đăng sau khi sản phẩm đó được đăng.
if OBJECT_ID('utr_cau2a', 'tr') is not null
drop trigger utr_cau2;
go
create trigger utr_cau2a on BINHLUAN
instead of insert
as begin