在 oracle 中實現 sql server 中的在 create object 時的判斷與刪除功能
在 oracle 中實現 sql server 中的在 create object 時的判斷與刪除功能[@more@]
/****** Object: Table OrderForm Script Date: 2006-7-4 8:39:19 ******/
ALTER TABLE OrderForm ADD (
CONSTRAINT FK_OrderForm_ShoppeDossier FOREIGN KEY
(
InceptStorageID
) REFERENCES ShoppeDossier (
ShoppeID
) NOVALIDATE
);
/* Formatted on 2006/07/06 14:34 (Formatter Plus v4.8.7) */
DECLARE
i_count INT := 0;
BEGIN
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_ALLOTSLIPSTYLE_TO_HEAD';
DECLARE
i_count INT := 0;
BEGIN
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_ALLOTSLIPSTYLE_TO_HEAD';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table ALLOTSLIPSTYLE drop constraints FK_ALLOTSLIPSTYLE_TO_HEAD';
i_count := 0;
END IF;
THEN
EXECUTE IMMEDIATE 'alter table ALLOTSLIPSTYLE drop constraints FK_ALLOTSLIPSTYLE_TO_HEAD';
i_count := 0;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_SERVERDBCON';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_SERVERDBCON';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_SERVERDBCON';
i_count := 0;
END IF;
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_SERVERDBCON';
i_count := 0;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_TO_BRANCH';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_TO_BRANCH';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_TO_BRANCH';
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_TO_BRANCH';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_TO_ORGANIZE';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_TO_ORGANIZE';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_TO_ORGANIZE';
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_TO_ORGANIZE';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_V_OR_P';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYDOSSIER_V_OR_P';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_V_OR_P';
THEN
EXECUTE IMMEDIATE 'alter table COMPANYDOSSIER drop constraints FK_COMPANYDOSSIER_V_OR_P';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYPERIOD_ACCOUNTANTCYC';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_COMPANYPERIOD_ACCOUNTANTCYC';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table COMPANYPERIOD drop constraints FK_COMPANYPERIOD_ACCOUNTANTCYC';
THEN
EXECUTE IMMEDIATE 'alter table COMPANYPERIOD drop constraints FK_COMPANYPERIOD_ACCOUNTANTCYC';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_FUTURESORDERFORM_S_DOSS';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_FUTURESORDERFORM_S_DOSS';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table FUTURESORDERFORM drop constraints FK_FUTURESORDERFORM_S_DOSS';
THEN
EXECUTE IMMEDIATE 'alter table FUTURESORDERFORM drop constraints FK_FUTURESORDERFORM_S_DOSS';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_INSTORAGEBDST_INSTORAGEBD';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_INSTORAGEBDST_INSTORAGEBD';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table INSTORAGEBDST drop constraints FK_INSTORAGEBDST_INSTORAGEBD';
THEN
EXECUTE IMMEDIATE 'alter table INSTORAGEBDST drop constraints FK_INSTORAGEBDST_INSTORAGEBD';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_INSTORAGEBDST_MEASUREUNITS';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_INSTORAGEBDST_MEASUREUNITS';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table INSTORAGEBDST drop constraints FK_INSTORAGEBDST_MEASUREUNITS';
THEN
EXECUTE IMMEDIATE 'alter table INSTORAGEBDST drop constraints FK_INSTORAGEBDST_MEASUREUNITS';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_ORDERFORM_SHOPPEDOSSIER';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_ORDERFORM_SHOPPEDOSSIER';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table ORDERFORM drop constraints FK_ORDERFORM_SHOPPEDOSSIER';
THEN
EXECUTE IMMEDIATE 'alter table ORDERFORM drop constraints FK_ORDERFORM_SHOPPEDOSSIER';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_OUTSTORAGEST_OUTSTORAGEHEAD';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_OUTSTORAGEST_OUTSTORAGEHEAD';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table OUTSTORAGEST drop constraints FK_OUTSTORAGEST_OUTSTORAGEHEAD';
THEN
EXECUTE IMMEDIATE 'alter table OUTSTORAGEST drop constraints FK_OUTSTORAGEST_OUTSTORAGEHEAD';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PERSONNELBASEINFO_COMPD';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PERSONNELBASEINFO_COMPD';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table PERSONNELBASEINFO drop constraints FK_PERSONNELBASEINFO_COMPD';
THEN
EXECUTE IMMEDIATE 'alter table PERSONNELBASEINFO drop constraints FK_PERSONNELBASEINFO_COMPD';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PERSONNELBASEINFO_TO_COMPB';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PERSONNELBASEINFO_TO_COMPB';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table PERSONNELBASEINFO drop constraints FK_PERSONNELBASEINFO_TO_COMPB';
THEN
EXECUTE IMMEDIATE 'alter table PERSONNELBASEINFO drop constraints FK_PERSONNELBASEINFO_TO_COMPB';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_PRODORGCLA';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_PRODORGCLA';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_PRODORGCLA';
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_PRODORGCLA';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_SELLPRODCLA';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_SELLPRODCLA';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_SELLPRODCLA';
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_SELLPRODCLA';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_MEASU';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_PRODMAIND_MEASU';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_MEASU';
THEN
EXECUTE IMMEDIATE 'alter table PRODUCTMAINDOSSIER drop constraints FK_PRODMAIND_MEASU';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_REQORDFORMST_MEASUREUNITS';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_REQORDFORMST_MEASUREUNITS';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table REQUIRORDERFORMST drop constraints FK_REQORDFORMST_MEASUREUNITS';
THEN
EXECUTE IMMEDIATE 'alter table REQUIRORDERFORMST drop constraints FK_REQORDFORMST_MEASUREUNITS';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_REQORDFORMST_REQORDFORM';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_REQORDFORMST_REQORDFORM';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table REQUIRORDERFORMST drop constraints FK_REQORDFORMST_REQORDFORM';
THEN
EXECUTE IMMEDIATE 'alter table REQUIRORDERFORMST drop constraints FK_REQORDFORMST_REQORDFORM';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SALESSLIPST_SALESSLIP';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SALESSLIPST_SALESSLIP';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table SALESSLIPST drop constraints FK_SALESSLIPST_SALESSLIP';
THEN
EXECUTE IMMEDIATE 'alter table SALESSLIPST drop constraints FK_SALESSLIPST_SALESSLIP';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SHPCHGGDSST_SHPCHGGDS';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SHPCHGGDSST_SHPCHGGDS';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table SHOPPECHANGEGOODSST drop constraints FK_SHPCHGGDSST_SHPCHGGDS';
i_count := 0;
END IF;
THEN
EXECUTE IMMEDIATE 'alter table SHOPPECHANGEGOODSST drop constraints FK_SHPCHGGDSST_SHPCHGGDS';
i_count := 0;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SHOPPED_COMPD';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SHOPPED_COMPD';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table SHOPPEDOSSIER drop constraints FK_SHOPPED_COMPD';
THEN
EXECUTE IMMEDIATE 'alter table SHOPPEDOSSIER drop constraints FK_SHOPPED_COMPD';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STORAGE_SERVERDBCON';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STORAGE_SERVERDBCON';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table STORAGE drop constraints FK_STORAGE_SERVERDBCON';
THEN
EXECUTE IMMEDIATE 'alter table STORAGE drop constraints FK_STORAGE_SERVERDBCON';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STOREPER_PERBASEINFO';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STOREPER_PERBASEINFO';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table STORAGEPERSONNEL drop constraints FK_STOREPER_PERBASEINFO';
i_count := 0;
END IF;
THEN
EXECUTE IMMEDIATE 'alter table STORAGEPERSONNEL drop constraints FK_STOREPER_PERBASEINFO';
i_count := 0;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STOREPER_STORAGE';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_STOREPER_STORAGE';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table STORAGEPERSONNEL drop constraints FK_STOREPER_STORAGE';
i_count := 0;
END IF;
THEN
EXECUTE IMMEDIATE 'alter table STORAGEPERSONNEL drop constraints FK_STOREPER_STORAGE';
i_count := 0;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SYSUSERACC_ACCPOP';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SYSUSERACC_ACCPOP';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table SYSUSERACCOUNT drop constraints FK_SYSUSERACC_ACCPOP';
THEN
EXECUTE IMMEDIATE 'alter table SYSUSERACCOUNT drop constraints FK_SYSUSERACC_ACCPOP';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SYSUSERACC_PERBASEINFO';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_SYSUSERACC_PERBASEINFO';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table SYSUSERACCOUNT drop constraints FK_SYSUSERACC_PERBASEINFO';
THEN
EXECUTE IMMEDIATE 'alter table SYSUSERACCOUNT drop constraints FK_SYSUSERACC_PERBASEINFO';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_VENDCONTCRED_VENDCONTMAINTB';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_VENDCONTCRED_VENDCONTMAINTB';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table VENDITIONCONTRACTCREDITED drop constraints FK_VENDCONTCRED_VENDCONTMAINTB';
THEN
EXECUTE IMMEDIATE 'alter table VENDITIONCONTRACTCREDITED drop constraints FK_VENDCONTCRED_VENDCONTMAINTB';
i_count := 0;
END IF;
END IF;
SELECT COUNT (*)
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_VENDCONTPRC_VENDCONTMAINTB';
INTO i_count
FROM user_constraints
WHERE constraint_name = 'FK_VENDCONTPRC_VENDCONTMAINTB';
IF i_count > 0
THEN
EXECUTE IMMEDIATE 'alter table VENDITIONCONTRACTPRICE drop constraints FK_VENDCONTPRC_VENDCONTMAINTB';
THEN
EXECUTE IMMEDIATE 'alter table VENDITIONCONTRACTPRICE drop constraints FK_VENDCONTPRC_VENDCONTMAINTB';
i_count := 0;
END IF;
end;
/
/****** Object: Table AllotSlipStyle Script Date: 2006-7-4 8:39:16 ******/
ALTER TABLE AllotSlipStyle ADD (
CONSTRAINT FK_AllotSlipStyle_To_Head FOREIGN KEY
(
AllotSlipHeadID
) REFERENCES AllotSlipHead (
AllotSlipHeadID
)
NOVALIDATE ) ;
END IF;
end;
/
/****** Object: Table AllotSlipStyle Script Date: 2006-7-4 8:39:16 ******/
ALTER TABLE AllotSlipStyle ADD (
CONSTRAINT FK_AllotSlipStyle_To_Head FOREIGN KEY
(
AllotSlipHeadID
) REFERENCES AllotSlipHead (
AllotSlipHeadID
)
NOVALIDATE ) ;
/****** Object: Table CompanyDossier Script Date: 2006-7-4 8:39:17 ******/
ALTER TABLE CompanyDossier ADD (
CONSTRAINT FK_CompanyDossier_To_Branch FOREIGN KEY
(
GatherCompanyID
) REFERENCES CompanyBranch (
BranchID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_To_Organize FOREIGN KEY
(
CompanyOrganiseID
) REFERENCES CompanyOrganize (
CompanyOrganizeID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_ServerDBCon FOREIGN KEY
(
ServerDBID
) REFERENCES ServerDBCon (
ServerDBID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_V_Or_P FOREIGN KEY
(
VenditionOrProvide
) REFERENCES VenditionOrProvide (
VenditionOrProvideID
) NOVALIDATE
) ;
ALTER TABLE CompanyDossier ADD (
CONSTRAINT FK_CompanyDossier_To_Branch FOREIGN KEY
(
GatherCompanyID
) REFERENCES CompanyBranch (
BranchID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_To_Organize FOREIGN KEY
(
CompanyOrganiseID
) REFERENCES CompanyOrganize (
CompanyOrganizeID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_ServerDBCon FOREIGN KEY
(
ServerDBID
) REFERENCES ServerDBCon (
ServerDBID
)NOVALIDATE,
CONSTRAINT FK_CompanyDossier_V_Or_P FOREIGN KEY
(
VenditionOrProvide
) REFERENCES VenditionOrProvide (
VenditionOrProvideID
) NOVALIDATE
) ;
/****** Object: Table CompanyPeriod Script Date: 2006-7-4 8:39:17 ******/
ALTER TABLE CompanyPeriod ADD (
CONSTRAINT FK_CompanyPeriod_AccountantCyc FOREIGN KEY
(
AccountantCycID
) REFERENCES AccountantCyc (
AccountantCycID
)
NOVALIDATE ) ;
ALTER TABLE CompanyPeriod ADD (
CONSTRAINT FK_CompanyPeriod_AccountantCyc FOREIGN KEY
(
AccountantCycID
) REFERENCES AccountantCyc (
AccountantCycID
)
NOVALIDATE ) ;
/****** Object: Table FuturesOrderForm Script Date: 2006-7-4 8:39:18 ******/
ALTER TABLE FuturesOrderForm ADD (
CONSTRAINT FK_FuturesOrderForm_S_Doss FOREIGN KEY
(
InceptStorageID
) REFERENCES ShoppeDossier (
ShoppeID
)
NOVALIDATE );
ALTER TABLE FuturesOrderForm ADD (
CONSTRAINT FK_FuturesOrderForm_S_Doss FOREIGN KEY
(
InceptStorageID
) REFERENCES ShoppeDossier (
ShoppeID
)
NOVALIDATE );
/****** Object: Table InStorageBDST Script Date: 2006-7-4 8:39:18 ******/
ALTER TABLE InStorageBDST ADD (
CONSTRAINT FK_InStorageBDST_InStorageBD FOREIGN KEY
(
InStorageFormHeadID
) REFERENCES InStorageBD (
InStorageFormHeadID
)NOVALIDATE,
CONSTRAINT FK_InStorageBDST_MeasureUnits FOREIGN KEY
(
MesureUnit
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE
) ;
ALTER TABLE InStorageBDST ADD (
CONSTRAINT FK_InStorageBDST_InStorageBD FOREIGN KEY
(
InStorageFormHeadID
) REFERENCES InStorageBD (
InStorageFormHeadID
)NOVALIDATE,
CONSTRAINT FK_InStorageBDST_MeasureUnits FOREIGN KEY
(
MesureUnit
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE
) ;
/****** Object: Table OrderForm Script Date: 2006-7-4 8:39:19 ******/
ALTER TABLE OrderForm ADD (
CONSTRAINT FK_OrderForm_ShoppeDossier FOREIGN KEY
(
InceptStorageID
) REFERENCES ShoppeDossier (
ShoppeID
) NOVALIDATE
);
/****** Object: Table OrderFormST Script Date: 2006-7-4 8:39:19 ******/
ALTER TABLE OrderFormST ADD (
CONSTRAINT FK_OrderFormST_MeasureUnits FOREIGN KEY
(
MeasureUnits
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE , -- NOT FOR REPLICATION
CONSTRAINT FK_OrderFormST_OrderForm FOREIGN KEY
(
OrderFormID
) REFERENCES OrderForm (
OrderFormID
) NOVALIDATE
);
ALTER TABLE OrderFormST ADD (
CONSTRAINT FK_OrderFormST_MeasureUnits FOREIGN KEY
(
MeasureUnits
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE , -- NOT FOR REPLICATION
CONSTRAINT FK_OrderFormST_OrderForm FOREIGN KEY
(
OrderFormID
) REFERENCES OrderForm (
OrderFormID
) NOVALIDATE
);
/****** Object: Table OutStorageST Script Date: 2006-7-4 8:39:20 ******/
ALTER TABLE OutStorageST ADD (
CONSTRAINT FK_OutStorageST_OutStorageHead FOREIGN KEY
(
OutStorageFormHeadID
) REFERENCES OutStorageHead (
OutStorageFormHeadID
)NOVALIDATE
) ;
ALTER TABLE OutStorageST ADD (
CONSTRAINT FK_OutStorageST_OutStorageHead FOREIGN KEY
(
OutStorageFormHeadID
) REFERENCES OutStorageHead (
OutStorageFormHeadID
)NOVALIDATE
) ;
/****** Object: Table PersonnelBaseInfo Script Date: 2006-7-4 8:39:21 ******/
--CompanyBranch --> CompB
--CompanyDossier --> ComD
ALTER TABLE PersonnelBaseInfo ADD (
CONSTRAINT FK_PersonnelBaseInfo_to_CompB FOREIGN KEY
(
PersonnelBelongBranch
) REFERENCES CompanyBranch (
BranchID
)NOVALIDATE,
CONSTRAINT FK_PersonnelBaseInfo_CompD FOREIGN KEY
(
BelongCompanyID
) REFERENCES CompanyDossier (
CompanyID
)NOVALIDATE
);
--CompanyBranch --> CompB
--CompanyDossier --> ComD
ALTER TABLE PersonnelBaseInfo ADD (
CONSTRAINT FK_PersonnelBaseInfo_to_CompB FOREIGN KEY
(
PersonnelBelongBranch
) REFERENCES CompanyBranch (
BranchID
)NOVALIDATE,
CONSTRAINT FK_PersonnelBaseInfo_CompD FOREIGN KEY
(
BelongCompanyID
) REFERENCES CompanyDossier (
CompanyID
)NOVALIDATE
);
/****** Object: Table ProductMainDossier Script Date: 2006-7-4 8:39:22 ******/
--MeasureUnits --> MeasU
--ProductOrganiseClass --> ProdOrgCla
--SellProductClass --> SellProdCla
--ProductMainDossier --> ProdMainD
ALTER TABLE ProductMainDossier ADD (
CONSTRAINT FK_ProdMainD_MeasU FOREIGN KEY
(
BasicMeasureUnits
) REFERENCES MeasureUnits (
UnitsID
)NOVALIDATE,
CONSTRAINT FK_ProdMainD_ProdOrgCla FOREIGN KEY
(
ProductMainClass
) REFERENCES ProductOrganiseClass (
ProductClassID
)NOVALIDATE,
CONSTRAINT FK_ProdMainD_SellProdCla FOREIGN KEY
(
Cards
) REFERENCES SellProductClass (
SellProductClassID
)NOVALIDATE
) ;
--MeasureUnits --> MeasU
--ProductOrganiseClass --> ProdOrgCla
--SellProductClass --> SellProdCla
--ProductMainDossier --> ProdMainD
ALTER TABLE ProductMainDossier ADD (
CONSTRAINT FK_ProdMainD_MeasU FOREIGN KEY
(
BasicMeasureUnits
) REFERENCES MeasureUnits (
UnitsID
)NOVALIDATE,
CONSTRAINT FK_ProdMainD_ProdOrgCla FOREIGN KEY
(
ProductMainClass
) REFERENCES ProductOrganiseClass (
ProductClassID
)NOVALIDATE,
CONSTRAINT FK_ProdMainD_SellProdCla FOREIGN KEY
(
Cards
) REFERENCES SellProductClass (
SellProductClassID
)NOVALIDATE
) ;
/****** Object: Table RequirOrderFormST Script Date: 2006-7-4 8:39:22 ******/
--RequirOrderFormST --> ReqOrdFormST
--RequirOrderForm --> ReqOrdForm
ALTER TABLE RequirOrderFormST ADD (
CONSTRAINT FK_ReqOrdFormST_MeasureUnits FOREIGN KEY
(
MeasureUnits
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE , ---NOT FOR REPLICATION
CONSTRAINT FK_ReqOrdFormST_ReqOrdForm FOREIGN KEY
(
OrderFormID
) REFERENCES RequirOrderForm (
OrderFormID
) NOVALIDATE
);
--RequirOrderFormST --> ReqOrdFormST
--RequirOrderForm --> ReqOrdForm
ALTER TABLE RequirOrderFormST ADD (
CONSTRAINT FK_ReqOrdFormST_MeasureUnits FOREIGN KEY
(
MeasureUnits
) REFERENCES MeasureUnits (
UnitsID
) NOVALIDATE , ---NOT FOR REPLICATION
CONSTRAINT FK_ReqOrdFormST_ReqOrdForm FOREIGN KEY
(
OrderFormID
) REFERENCES RequirOrderForm (
OrderFormID
) NOVALIDATE
);
/****** Object: Table SYSUserAccount Script Date: 2006-7-4 8:39:22 ******/
--SYSUserAccount --> SYSUserAcc
--AccountsPopedom --> AccPop
--PersonnelBaseInfo --> PerBaseInfo
ALTER TABLE SYSUserAccount ADD (
CONSTRAINT FK_SYSUserAcc_AccPop FOREIGN KEY
(
UseAccount
) REFERENCES AccountsPopedom (
PopedomID
)NOVALIDATE,
CONSTRAINT FK_SYSUserAcc_PerBaseInfo FOREIGN KEY
(
PersonnelID
) REFERENCES PersonnelBaseInfo (
PersonnelID
)NOVALIDATE
);
--SYSUserAccount --> SYSUserAcc
--AccountsPopedom --> AccPop
--PersonnelBaseInfo --> PerBaseInfo
ALTER TABLE SYSUserAccount ADD (
CONSTRAINT FK_SYSUserAcc_AccPop FOREIGN KEY
(
UseAccount
) REFERENCES AccountsPopedom (
PopedomID
)NOVALIDATE,
CONSTRAINT FK_SYSUserAcc_PerBaseInfo FOREIGN KEY
(
PersonnelID
) REFERENCES PersonnelBaseInfo (
PersonnelID
)NOVALIDATE
);
/****** Object: Table SalesSlipST Script Date: 2006-7-4 8:39:23 ******/
ALTER TABLE SalesSlipST ADD (
CONSTRAINT FK_SalesSlipST_SalesSlip FOREIGN KEY
(
SystemInvoiceID
) REFERENCES SalesSlip (
SystemInvoiceID
)NOVALIDATE
) ;
ALTER TABLE SalesSlipST ADD (
CONSTRAINT FK_SalesSlipST_SalesSlip FOREIGN KEY
(
SystemInvoiceID
) REFERENCES SalesSlip (
SystemInvoiceID
)NOVALIDATE
) ;
/****** Object: Table ShoppeChangeGoodsST Script Date: 2006-7-4 8:39:24 ******/
--ShoppeChangeGoodsST --> ShpChgGdsST
--ShoppeChangeGoods --> ShpChgGds
ALTER TABLE ShoppeChangeGoodsST ADD (
CONSTRAINT FK_ShpChgGdsST_ShpChgGds FOREIGN KEY
(
ChangeGoodsID
) REFERENCES ShoppeChangeGoods (
ChangeGoodsID
)NOVALIDATE
);
--ShoppeChangeGoodsST --> ShpChgGdsST
--ShoppeChangeGoods --> ShpChgGds
ALTER TABLE ShoppeChangeGoodsST ADD (
CONSTRAINT FK_ShpChgGdsST_ShpChgGds FOREIGN KEY
(
ChangeGoodsID
) REFERENCES ShoppeChangeGoods (
ChangeGoodsID
)NOVALIDATE
);
/****** Object: Table ShoppeDossier Script Date: 2006-7-4 8:39:25 ******/
--ShopperDossier --> ShoppeD
--CompanyDossier --> CompD
ALTER TABLE ShoppeDossier ADD (
CONSTRAINT FK_ShoppeD_CompD FOREIGN KEY
(
SquareCompanyID
) REFERENCES CompanyDossier (
CompanyID
)NOVALIDATE
) ;
--ShopperDossier --> ShoppeD
--CompanyDossier --> CompD
ALTER TABLE ShoppeDossier ADD (
CONSTRAINT FK_ShoppeD_CompD FOREIGN KEY
(
SquareCompanyID
) REFERENCES CompanyDossier (
CompanyID
)NOVALIDATE
) ;
/****** Object: Table Storage Script Date: 2006-7-4 8:39:25 ******/
ALTER TABLE Storage ADD (
CONSTRAINT FK_Storage_ServerDBCon FOREIGN KEY
(
ServerDBID
) REFERENCES ServerDBCon (
ServerDBID
)NOVALIDATE
) ;
ALTER TABLE Storage ADD (
CONSTRAINT FK_Storage_ServerDBCon FOREIGN KEY
(
ServerDBID
) REFERENCES ServerDBCon (
ServerDBID
)NOVALIDATE
) ;
/****** Object: Table StoragePersonnel Script Date: 2006-7-4 8:39:25 ******/
--StoragePersonnel --> StorePer
--PersonnelBaseInfo --> PerBaseInfo
ALTER TABLE StoragePersonnel ADD (
CONSTRAINT FK_StorePer_PerBaseInfo FOREIGN KEY
(
PersonnelID
) REFERENCES PersonnelBaseInfo (
PersonnelID
)NOVALIDATE,
CONSTRAINT FK_StorePer_Storage FOREIGN KEY
(
StorageID
) REFERENCES Storage (
StorageID
)NOVALIDATE
) ;
--StoragePersonnel --> StorePer
--PersonnelBaseInfo --> PerBaseInfo
ALTER TABLE StoragePersonnel ADD (
CONSTRAINT FK_StorePer_PerBaseInfo FOREIGN KEY
(
PersonnelID
) REFERENCES PersonnelBaseInfo (
PersonnelID
)NOVALIDATE,
CONSTRAINT FK_StorePer_Storage FOREIGN KEY
(
StorageID
) REFERENCES Storage (
StorageID
)NOVALIDATE
) ;
/****** Object: Table VenditionContractCredited Script Date: 2006-7-4 8:39:25 ******/
--VenditionContractCredited --> VendContCred
--VenditionContractMainTB --> VendContMainTB
ALTER TABLE VenditionContractCredited ADD (
CONSTRAINT FK_VendContCred_VendContMainTB FOREIGN KEY
(
ContractID
) REFERENCES VenditionContractMainTB (
ContractID
)NOVALIDATE
) ;
--VenditionContractCredited --> VendContCred
--VenditionContractMainTB --> VendContMainTB
ALTER TABLE VenditionContractCredited ADD (
CONSTRAINT FK_VendContCred_VendContMainTB FOREIGN KEY
(
ContractID
) REFERENCES VenditionContractMainTB (
ContractID
)NOVALIDATE
) ;
/****** Object: Table VenditionContractPrice Script Date: 2006-7-4 8:39:27 ******/
--VenditionContractPrice --> VendContPrc
--VenditionContractMainTB --> VendContMainTB
ALTER TABLE VenditionContractPrice ADD (
CONSTRAINT FK_VendContPrc_VendContMainTB FOREIGN KEY
(
ContractID
) REFERENCES VenditionContractMainTB (
ContractID
)NOVALIDATE
) ;
--VenditionContractPrice --> VendContPrc
--VenditionContractMainTB --> VendContMainTB
ALTER TABLE VenditionContractPrice ADD (
CONSTRAINT FK_VendContPrc_VendContMainTB FOREIGN KEY
(
ContractID
) REFERENCES VenditionContractMainTB (
ContractID
)NOVALIDATE
) ;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/66634/viewspace-847471/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在SQL Server中快速刪除重複記錄(轉)SQLServer
- order by在SQL Server與Oracle中的一個區別SQLServerOracle
- 在SQL SERVER中實現事務的部分回滾SQLServer
- thread在surfaceview中的使用與刪除threadView
- 怎樣在PB中實現檔案的複製與刪除 (轉)
- 在Oracle中實現定時操作Oracle
- Oracle與SQL Server在企業應用中的比較(轉)OracleSQLServer
- 臨時表在Oracle資料庫與SQL Server資料庫中的異同Oracle資料庫SQLServer
- 在SQL SERVER中實現RSA加密演算法SQLServer加密演算法
- 在SQL Server 2005中實現表的行列轉換SQLServer
- 在SQL Server中獲得不包含時間部分的日期SQLServer
- 在JavaScript中判斷整型的N種方法JavaScript
- 在Oracle中,如何定時刪除歸檔日誌檔案?Oracle
- 如何在SQL Server中實現 Limit m,n 的功能SQLServerMIT
- golang map的判斷,刪除Golang
- Oracle中刪除重複資料的SqlOracleSQL
- 在 Linux 中如何刪除檔案中的空行Linux
- 在SQL Server中對檢視進行增刪改SQLServer
- java中判斷Object物件型別JavaObject物件型別
- 如何刪除在Github中建立的專案Github
- 在ASP中讀取ORACLE中的BLOB型別的欄位的值,不用Oracle Object for Object (轉)Oracle型別Object
- 在MySQL中利用外來鍵實現級聯刪除(轉)MySql
- 在Swift中實現撤銷功能Swift
- 判斷是否在微信瀏覽器中瀏覽器
- sql server中預設約束的通用sql指令碼的刪除方法SQLServer指令碼
- 在Oracle中,如何判斷一個字串是否為數字?Oracle字串
- Oracle DG standby刪除歸檔的判斷指令碼Oracle指令碼
- 在java中實現對FORM的列印功能 (轉)JavaORM
- Laravel 中利用『模型事件』來實現刪除資料時的連帶刪除Laravel模型事件
- sql server 中刪除內容重複的某條記錄SQLServer
- SQL Server中刪除重複資料的幾個方法SQLServer
- javascript模擬實現in_array()判斷指定元素是否在陣列中JavaScript陣列
- SQL Server 觸發器的修改與刪除SQLServer觸發器
- Java在PDF中刪除註釋Java
- Sql Server中判斷表或者資料庫是否存在SQLServer資料庫
- Sql server 2005遷移至Oracle系列之三:在Oracle中建立sql中的常見函式SQLServerOracle函式
- 在 CentOS 8 中刪除舊的 Linux 核心CentOSLinux
- 如何判斷sql中的索引是否生效SQL索引