在 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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 在Oracle中,如何定時刪除歸檔日誌檔案?Oracle
- 如何在SQL Server中實現 Limit m,n 的功能SQLServerMIT
- golang map的判斷,刪除Golang
- 在 Linux 中如何刪除檔案中的空行Linux
- 在 CentOS 8 中刪除舊的 Linux 核心CentOSLinux
- 如何判斷sql中的索引是否生效SQL索引
- Laravel 中利用『模型事件』來實現刪除資料時的連帶刪除Laravel模型事件
- 在LVM中恢復已刪除的物理卷LVM
- 在Swift中實現撤銷功能Swift
- 在WPF程式中實現PropertyGrid功能
- Java在PDF中刪除註釋Java
- 淺析js中的Object.create()JSObject
- 在 Python 除錯過程中設定不中斷的斷點Python除錯斷點
- Oracle中的sql%rowcount在瀚高資料庫中的相容方案OracleSQL資料庫
- Oracle中刪除表中的重複資料Oracle
- PHP 判斷一個字元是否在字串中PHP字元字串
- Array · 判斷某元素是否在陣列中陣列
- 在LVM中恢復已刪除的邏輯卷LVM
- 在 CentOS 8 中刪除舊的 Linux 系統核心CentOSLinux
- Python在類中實現swith case功能Python
- 在ArrayList的迴圈中刪除元素,會不會出現問題?
- 在Oracle SQL中設定每週的起始日期IOOracleSQL
- 一看就懂!任務提交的資源判斷在Taier中的實踐AI
- Object.create(..)和new(..)的內部實現Object
- SQL Server中的日期和時間:DATEADD()SQLServer
- 在vSphere中實現複製貼上功能
- 解讀vue-server-renderer原始碼並在react中的實現VueServer原始碼React
- 【TUNE_ORACLE】檢視Oracle的壞塊在空閒空間中還是在已用空間中的SQL參考OracleSQL
- OQL(物件查詢語言)在產品實現中造成的RCE(Object Injection)物件Object
- cookie與session的區別以及在Django中的實現CookieSessionDjango
- 在 Azure CentOS VM 中配置 SQL Server 2019 AG - (上)CentOSSQLServer
- 在SQL Server中完美壓縮.mdf檔案DVSQLServer
- 【OracleEBS】 在PL/SQL中呼叫Oracle ERP請求OracleSQL
- oracle中if/else功能的實現的3種寫法Oracle
- 在 Web 中判斷頁面是不是重新整理Web
- PostgreSQL、Oracle/MySQL和SQL Server的MVCC實現原理方式OracleMySqlServerMVC
- vue 工作專案中 實現訊息列表的 全選,反選,刪除功能Vue
- 【PWA學習與實踐】(6) 在Chrome中除錯你的PWAChrome除錯
- 關於SQL Server中儲存過程在C#中呼叫的簡單示例SQLServer儲存過程C#