IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_BuyLimit_Category]') AND type = 'F')
ALTER TABLE [dbo].[BuyLimit] DROP CONSTRAINT [FK_BuyLimit_Category]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_CatBrand_Brand]') AND type = 'F')
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 type = 'F')
ALTER TABLE [dbo].[CatBrand] DROP CONSTRAINT [FK_CatBrand_Category]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_CouponMember_Coupon]') AND type = 'F')
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 type = 'F')
ALTER TABLE [dbo].[CouponMember] DROP CONSTRAINT [FK_CouponMember_Member]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_CouponsOrderItems_Coupons]') AND type = 'F')
ALTER TABLE [dbo].[CouponsOrderItems] DROP CONSTRAINT [FK_CouponsOrderItems_Coupons]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_CouponsUsedItems_Coupons]') AND type = 'F')
ALTER TABLE [dbo].[CouponsUsedItems] DROP CONSTRAINT [FK_CouponsUsedItems_Coupons]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_CouponsUsedItems_Orders]') AND type = 'F')
ALTER TABLE [dbo].[CouponsUsedItems] DROP CONSTRAINT [FK_CouponsUsedItems_Orders]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_GiftOrderItem_GiftOrder]') AND type = 'F')
ALTER TABLE [dbo].[GiftOrderItem] DROP CONSTRAINT [FK_GiftOrderItem_GiftOrder]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_NewProduct_Product]') AND type = 'F')
ALTER TABLE [dbo].[NewProduct] DROP CONSTRAINT [FK_NewProduct_Product]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_News_Article_News_Category]') AND type = 'F')
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 type = 'F')
ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT [FK_OrderProduct_Orders]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_PmtGenCoupons_Promotion]') AND type = 'F')
ALTER TABLE [dbo].[PmtGenCoupons] DROP CONSTRAINT [FK_PmtGenCoupons_Promotion]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_PmtProduct_Promotion]') AND type = 'F')
ALTER TABLE [dbo].[PmtProduct] DROP CONSTRAINT [FK_PmtProduct_Promotion]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_ProductField_CategoryField]') AND type = 'F')
ALTER TABLE [dbo].[ProductField] DROP CONSTRAINT [FK_ProductField_CategoryField]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_PromotionMemberGroup_Promotion]') AND type = 'F')
ALTER TABLE [dbo].[PromotionMemberGroup] DROP CONSTRAINT [FK_PromotionMemberGroup_Promotion]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_ShippPay_Shipping]') AND type = 'F')
ALTER TABLE [dbo].[ShippPay] DROP CONSTRAINT [FK_ShippPay_Shipping]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_ShippPay_ShippingArea]') AND type = 'F')
ALTER TABLE [dbo].[ShippPay] DROP CONSTRAINT [FK_ShippPay_ShippingArea]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SubscriptionsContent_Member]') AND type = 'F')
ALTER TABLE [dbo].[SubscriptionsContent] DROP CONSTRAINT [FK_SubscriptionsContent_Member]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SubscriptionsContent_SubscriptionsOptions]') AND type = 'F')
ALTER TABLE [dbo].[SubscriptionsContent] DROP CONSTRAINT [FK_SubscriptionsContent_SubscriptionsOptions]
;
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SubscriptionsOptions_Subscriptions]') AND type = 'F')
ALTER TABLE [dbo].[SubscriptionsOptions] DROP CONSTRAINT [FK_SubscriptionsOptions_Subscriptions]
;


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

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

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

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

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

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

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

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

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

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

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