if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CatBrand_Brand]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CatBrand] DROP CONSTRAINT FK_CatBrand_Brand
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CatBrand_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CatBrand] DROP CONSTRAINT FK_CatBrand_Category
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CatProduct_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CatProduct] DROP CONSTRAINT FK_CatProduct_Category
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_ProductField_CategoryField]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[ProductField] DROP CONSTRAINT FK_ProductField_CategoryField
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CouponMember_Coupon]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CouponMember] DROP CONSTRAINT FK_CouponMember_Coupon
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CouponMember_Member]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CouponMember] DROP CONSTRAINT FK_CouponMember_Member
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_News_Article_News_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[News_Article] DROP CONSTRAINT FK_News_Article_News_Category
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_OrderProduct_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT FK_OrderProduct_Orders
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_CatProduct_Product]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[CatProduct] DROP CONSTRAINT FK_CatProduct_Product
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_Member_Finance]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_Member_Finance]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_Agent_Status]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_Agent_Status]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Delete_Agent]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Delete_Agent]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_Product]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_Product]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_CatProduct_CatBrand]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_CatProduct_CatBrand]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[NewProductDelete]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[NewProductDelete]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Delete_CatProduct]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Delete_CatProduct]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_Product_Storage]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_Product_Storage]
;

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_Update_Product_StorageCheck]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[T_Update_Product_StorageCheck]
;
