
ALTER TABLE VS4TACChart ALTER COLUMN TACCTAGsCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TACChart ADD 
CONSTRAINT VS4TACGroupSubVS4TACChart FOREIGN KEY 
(
TACCTAGsCode
) REFERENCES VS4TACGroupSub (
TAGsCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAccountMap ALTER COLUMN TACMTACCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAccountMap ADD 
CONSTRAINT VS4TACChartVS4TAccountMap FOREIGN KEY 
(
TACMTACCCode
) REFERENCES VS4TACChart (
TACCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAccountPeriod ALTER COLUMN TACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TAccountPeriod ADD 
CONSTRAINT VS4TAccountYearVS4TAccountPeriod FOREIGN KEY 
(
TACPTACYID
) REFERENCES VS4TAccountYear (
TACYID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAccountSetMB ALTER COLUMN TACMTACSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAccountSetMB ADD 
CONSTRAINT VS4TAccountSetVS4TAccountSetMB FOREIGN KEY 
(
TACMTACSCode
) REFERENCES VS4TAccountSet (
TACSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TACFormatMB ALTER COLUMN TAFMTACCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TACFormatMB ADD 
CONSTRAINT VS4TACChartVS4TACFormatMB FOREIGN KEY 
(
TAFMTACCCode
) REFERENCES VS4TACChart (
TACCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TACFormatMB ALTER COLUMN TAFMTACFCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TACFormatMB ADD 
CONSTRAINT VS4TACFormatVS4TACFormatMB FOREIGN KEY 
(
TAFMTACFCode
) REFERENCES VS4TACFormat (
TACFCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TACGroupSub ALTER COLUMN TAGsTACGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TACGroupSub ADD 
CONSTRAINT VS4TACGroupVS4TACGroupSub FOREIGN KEY 
(
TAGsTACGCode
) REFERENCES VS4TACGroup (
TACGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAirSchedule ALTER COLUMN TAISTAILCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAirSchedule ADD 
CONSTRAINT VS4TAirlineVS4TAirSchedule FOREIGN KEY 
(
TAISTAILCode
) REFERENCES VS4TAirline (
TAILCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAP ALTER COLUMN TAPNTAPTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAP ADD 
CONSTRAINT VS4TAPTypeVS4TAP FOREIGN KEY 
(
TAPNTAPTCode
) REFERENCES VS4TAPType (
TAPTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAP ALTER COLUMN TAPNTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAP ADD 
CONSTRAINT VS4TBusinessTypeVS4TAP FOREIGN KEY 
(
TAPNTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAP ALTER COLUMN TAPNTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TAP ADD 
CONSTRAINT VS4TCountryVS4TAP FOREIGN KEY 
(
TAPNTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAP2 ALTER COLUMN TAP2TAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAP2 ADD 
CONSTRAINT VS4TAPVS4TAP2 FOREIGN KEY 
(
TAP2TAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBalance ALTER COLUMN TAPLTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TAPBalance ALTER COLUMN TAPLTACPID INT NOT NULL 
GO

ALTER TABLE VS4TAPBalance ADD 
CONSTRAINT VS4TAccountPeriodVS4TAPBalance FOREIGN KEY 
(
TAPLTACPTACYID,TAPLTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBalance ALTER COLUMN TAPLTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBalance ADD 
CONSTRAINT VS4TAPVS4TAPBalance FOREIGN KEY 
(
TAPLTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBank ALTER COLUMN TAPBTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBank ADD 
CONSTRAINT VS4TAPVS4TAPBank FOREIGN KEY 
(
TAPBTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBank ALTER COLUMN TAPBTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBank ADD 
CONSTRAINT VS4TBankVS4TAPBank FOREIGN KEY 
(
TAPBTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBill ALTER COLUMN TPBITAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBill ADD 
CONSTRAINT VS4TAPVS4TAPBill FOREIGN KEY 
(
TPBITAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBill ALTER COLUMN TPBITPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBill ADD 
CONSTRAINT VS4TProjectVS4TAPBill FOREIGN KEY 
(
TPBITPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBillMB ALTER COLUMN TPBMTPBINo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBillMB ADD 
CONSTRAINT VS4TAPBillVS4TAPBillMB FOREIGN KEY 
(
TPBMTPBINo
) REFERENCES VS4TAPBill (
TPBINo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBusinessType ALTER COLUMN TAPYTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBusinessType ADD 
CONSTRAINT VS4TAPVS4TAPBusinessType FOREIGN KEY 
(
TAPYTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPBusinessType ALTER COLUMN TAPYTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPBusinessType ADD 
CONSTRAINT VS4TBusinessTypeVS4TAPBusinessType FOREIGN KEY 
(
TAPYTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPCard ALTER COLUMN TPICTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPCard ADD 
CONSTRAINT VS4TAPVS4TAPCard FOREIGN KEY 
(
TPICTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPContact ALTER COLUMN TAPCTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPContact ADD 
CONSTRAINT VS4TAPVS4TAPContact FOREIGN KEY 
(
TAPCTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPCreditLimit ALTER COLUMN TPCLTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPCreditLimit ADD 
CONSTRAINT VS4TAPVS4TAPCreditLimit FOREIGN KEY 
(
TPCLTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPCreditNote ALTER COLUMN TPCNTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPCreditNote ADD 
CONSTRAINT VS4TAPVS4TAPCreditNote FOREIGN KEY 
(
TPCNTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPCreditNote ALTER COLUMN TPCNTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPCreditNote ADD 
CONSTRAINT VS4TProjectVS4TAPCreditNote FOREIGN KEY 
(
TPCNTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPCreditNoteMB ALTER COLUMN TPCMTPCNNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPCreditNoteMB ADD 
CONSTRAINT VS4TAPCreditNoteVS4TAPCreditNoteMB FOREIGN KEY 
(
TPCMTPCNNo
) REFERENCES VS4TAPCreditNote (
TPCNNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebitNote ALTER COLUMN TDENTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebitNote ADD 
CONSTRAINT VS4TAPVS4TAPDebitNote FOREIGN KEY 
(
TDENTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebitNote ALTER COLUMN TDENTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebitNote ADD 
CONSTRAINT VS4TProjectVS4TAPDebitNote FOREIGN KEY 
(
TDENTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebitNoteMB ALTER COLUMN TDEBTDENNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebitNoteMB ADD 
CONSTRAINT VS4TAPDebitNoteVS4TAPDebitNoteMB FOREIGN KEY 
(
TDEBTDENNo
) REFERENCES VS4TAPDebitNote (
TDENNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjust ALTER COLUMN TPAJTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjust ADD 
CONSTRAINT VS4TAPVS4TAPDebtAdjust FOREIGN KEY 
(
TPAJTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjust ALTER COLUMN TPAJTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjust ADD 
CONSTRAINT VS4TBranchVS4TAPDebtAdjust FOREIGN KEY 
(
TPAJTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjust ALTER COLUMN TPAJTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjust ADD 
CONSTRAINT VS4TCurrencyVS4TAPDebtAdjust FOREIGN KEY 
(
TPAJTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjust ALTER COLUMN TPAJTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjust ADD 
CONSTRAINT VS4TProjectVS4TAPDebtAdjust FOREIGN KEY 
(
TPAJTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjustMB ALTER COLUMN TPJMTPJANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjustMB ADD 
CONSTRAINT VS4TAPDebtAdjustVS4TAPDebtAdjustMB FOREIGN KEY 
(
TPJMTPJANo
) REFERENCES VS4TAPDebtAdjust (
TPAJNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPDebtAdjustMB ALTER COLUMN TPJMTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TAPDebtAdjustMB ADD 
CONSTRAINT VS4TCurrencyVS4TAPDebtAdjustMB FOREIGN KEY 
(
TPJMTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoice ALTER COLUMN TIAPTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoice ADD 
CONSTRAINT VS4TAPVS4TAPInvoice FOREIGN KEY 
(
TIAPTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoice ALTER COLUMN TIAPTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoice ADD 
CONSTRAINT VS4TProjectVS4TAPInvoice FOREIGN KEY 
(
TIAPTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoiceCost ALTER COLUMN TIPCTIAPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoiceCost ADD 
CONSTRAINT VS4TAPInvoiceVS4TAPInvoiceCost FOREIGN KEY 
(
TIPCTIAPNo
) REFERENCES VS4TAPInvoice (
TIAPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoiceMB ALTER COLUMN TIPMTIAPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoiceMB ADD 
CONSTRAINT VS4TAPInvoiceVS4TAPInvoiceMB FOREIGN KEY 
(
TIPMTIAPNo
) REFERENCES VS4TAPInvoice (
TIAPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoicePay ALTER COLUMN TPIPTIAPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoicePay ADD 
CONSTRAINT VS4TAPInvoiceVS4TAPInvoicePay FOREIGN KEY 
(
TPIPTIAPNo
) REFERENCES VS4TAPInvoice (
TIAPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoicePay ALTER COLUMN TPIPTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPInvoicePay ADD 
CONSTRAINT VS4TCompanyBankVS4TAPInvoicePay FOREIGN KEY 
(
TPIPTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPInvoicePay ALTER COLUMN TPIPPaymentType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TAPInvoicePay ADD 
CONSTRAINT VS4TPaymentTypeVS4TAPInvoicePay FOREIGN KEY 
(
TPIPPaymentType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPScroll ALTER COLUMN TASCTASGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPScroll ADD 
CONSTRAINT VS4TAPScrollGroupVS4TAPScroll FOREIGN KEY 
(
TASCTASGAlias
) REFERENCES VS4TAPScrollGroup (
TASGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVDocRef ALTER COLUMN TPVRTAPVNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPVDocRef ADD 
CONSTRAINT VS4TAPVoucherVS4TAPVDocRef FOREIGN KEY 
(
TPVRTAPVNo
) REFERENCES VS4TAPVoucher (
TAPVNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVoucher ALTER COLUMN TAPVTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPVoucher ADD 
CONSTRAINT VS4TAPVS4TAPVoucher FOREIGN KEY 
(
TAPVTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVoucher ALTER COLUMN TAPVTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPVoucher ADD 
CONSTRAINT VS4TProjectVS4TAPVoucher FOREIGN KEY 
(
TAPVTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVoucherPay ALTER COLUMN TPVPTAPVNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPVoucherPay ADD 
CONSTRAINT VS4TAPVoucherVS4TAPVoucherPay FOREIGN KEY 
(
TPVPTAPVNo
) REFERENCES VS4TAPVoucher (
TAPVNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVoucherPay ALTER COLUMN TPVPTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAPVoucherPay ADD 
CONSTRAINT VS4TCompanyBankVS4TAPVoucherPay FOREIGN KEY 
(
TPVPTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAPVoucherPay ALTER COLUMN TPVPPaymentType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TAPVoucherPay ADD 
CONSTRAINT VS4TPaymentTypeVS4TAPVoucherPay FOREIGN KEY 
(
TPVPPaymentType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR ALTER COLUMN TARNTARSAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAR ADD 
CONSTRAINT VS4TARStatusVS4TAR FOREIGN KEY 
(
TARNTARSAlias
) REFERENCES VS4TARStatus (
TARSAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR ALTER COLUMN TARNTARTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAR ADD 
CONSTRAINT VS4TARTypeVS4TAR FOREIGN KEY 
(
TARNTARTCode
) REFERENCES VS4TARType (
TARTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR ALTER COLUMN TARNTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAR ADD 
CONSTRAINT VS4TBusinessTypeVS4TAR FOREIGN KEY 
(
TARNTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR ALTER COLUMN TARNTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TAR ADD 
CONSTRAINT VS4TCountryVS4TAR FOREIGN KEY 
(
TARNTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR2 ALTER COLUMN TAR2TARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAR2 ADD 
CONSTRAINT VS4TARVS4TAR2 FOREIGN KEY 
(
TAR2TARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR2 ALTER COLUMN TAR2TSPvCode NVARCHAR (4) NOT NULL 
GO

ALTER TABLE VS4TAR2 ADD 
CONSTRAINT VS4TDistrictVS4TAR2 FOREIGN KEY 
(
TAR2TSPvCode
) REFERENCES VS4TDistrict (
TSPVCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR2 ALTER COLUMN TAR2TPrvCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TAR2 ADD 
CONSTRAINT VS4TProvinceVS4TAR2 FOREIGN KEY 
(
TAR2TPrvCode
) REFERENCES VS4TProvince (
TPrvCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAR3 ALTER COLUMN TAR3TARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAR3 ADD 
CONSTRAINT VS4TARVS4TAR3 FOREIGN KEY 
(
TAR3TARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointComp ALTER COLUMN TARMTARANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointComp ADD 
CONSTRAINT VS4TARAppointmentVS4TARAppointComp FOREIGN KEY 
(
TARMTARANo
) REFERENCES VS4TARAppointment (
TARANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointComp ALTER COLUMN TARMTTCPSTCPTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointComp ALTER COLUMN TARMTCPSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointComp ADD 
CONSTRAINT VS4TCompetSectionVS4TARAppointComp FOREIGN KEY 
(
TARMTTCPSTCPTCode,TARMTCPSCode
) REFERENCES VS4TCompetSection (
TCPSTCPTCodeTCPSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointMedia ALTER COLUMN TARETARANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointMedia ADD 
CONSTRAINT VS4TARAppointmentVS4TARAppointMedia FOREIGN KEY 
(
TARETARANo
) REFERENCES VS4TARAppointment (
TARANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointMedia ALTER COLUMN TARETMedCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointMedia ADD 
CONSTRAINT VS4TMediaVS4TARAppointMedia FOREIGN KEY 
(
TARETMedCode
) REFERENCES VS4TMedia (
TMedCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointment ALTER COLUMN TARATAtyCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointment ADD 
CONSTRAINT VS4TAppointTypeVS4TARAppointment FOREIGN KEY 
(
TARATAtyCode
) REFERENCES VS4TAppointType (
TAtyCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointment ALTER COLUMN TARATARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointment ADD 
CONSTRAINT VS4TARVS4TARAppointment FOREIGN KEY 
(
TARATARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARAppointment ALTER COLUMN TARATEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARAppointment ADD 
CONSTRAINT VS4TEmployeeVS4TARAppointment FOREIGN KEY 
(
TARATEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBalance ALTER COLUMN TARLTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TARBalance ALTER COLUMN TARLTACPID INT NOT NULL 
GO

ALTER TABLE VS4TARBalance ADD 
CONSTRAINT VS4TAccountPeriodVS4TARBalance FOREIGN KEY 
(
TARLTACPTACYID,TARLTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBalance ALTER COLUMN TARLTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBalance ADD 
CONSTRAINT VS4TARVS4TARBalance FOREIGN KEY 
(
TARLTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBill ALTER COLUMN TBilTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBill ADD 
CONSTRAINT VS4TARVS4TBill FOREIGN KEY 
(
TBilTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBill ALTER COLUMN TBilTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBill ADD 
CONSTRAINT VS4TProjectVS4TARBill FOREIGN KEY 
(
TBilTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBillMB ALTER COLUMN TBMBTBilNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBillMB ADD 
CONSTRAINT VS4TBillVS4TBillMB FOREIGN KEY 
(
TBMBTBilNo
) REFERENCES VS4TARBill (
TBilNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBranch ALTER COLUMN TARDTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBranch ADD 
CONSTRAINT VS4TARVS4TARDelivery FOREIGN KEY 
(
TARDTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBusinessType ALTER COLUMN TARBTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBusinessType ADD 
CONSTRAINT VS4TARVS4TARBusinessType FOREIGN KEY 
(
TARBTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARBusinessType ALTER COLUMN TARBTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARBusinessType ADD 
CONSTRAINT VS4TBusinessTypeVS4TARBusinessType FOREIGN KEY 
(
TARBTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARCard ALTER COLUMN TRICTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARCard ADD 
CONSTRAINT VS4TARVS4TARCard FOREIGN KEY 
(
TRICTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARContact ALTER COLUMN TARCTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARContact ADD 
CONSTRAINT VS4TARVS4TARContact FOREIGN KEY 
(
TARCTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARCreditLimit ALTER COLUMN TRCLTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARCreditLimit ADD 
CONSTRAINT VS4TARVS4TARCreditLimit FOREIGN KEY 
(
TRCLTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARCreditNote ALTER COLUMN TRCNTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARCreditNote ADD 
CONSTRAINT VS4TARVS4TARCreditNote FOREIGN KEY 
(
TRCNTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARCreditNote ALTER COLUMN TRCNTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARCreditNote ADD 
CONSTRAINT VS4TProjectVS4TARCreditNote FOREIGN KEY 
(
TRCNTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARCreditNoteMB ALTER COLUMN TRCMTRCNNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARCreditNoteMB ADD 
CONSTRAINT VS4TARCreditNoteVS4TARCreditNoteMB FOREIGN KEY 
(
TRCMTRCNNo
) REFERENCES VS4TARCreditNote (
TRCNNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebitNote ALTER COLUMN TDBNTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebitNote ADD 
CONSTRAINT VS4TARVS4TARDebitNote FOREIGN KEY 
(
TDBNTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebitNote ALTER COLUMN TDBNTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebitNote ADD 
CONSTRAINT VS4TProjectVS4TARDebitNote FOREIGN KEY 
(
TDBNTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebitNoteMB ALTER COLUMN TDBMTDBNNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebitNoteMB ADD 
CONSTRAINT VS4TARDebitNoteVS4TARDebitNoteMB FOREIGN KEY 
(
TDBMTDBNNo
) REFERENCES VS4TARDebitNote (
TDBNNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjust ALTER COLUMN TRAJTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjust ADD 
CONSTRAINT VS4TARVS4TARDebtAdjust FOREIGN KEY 
(
TRAJTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjust ALTER COLUMN TRAJTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjust ADD 
CONSTRAINT VS4TBranchVS4TARDebtAdjust FOREIGN KEY 
(
TRAJTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjust ALTER COLUMN TRAJTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjust ADD 
CONSTRAINT VS4TCurrencyVS4TARDebtAdjust FOREIGN KEY 
(
TRAJTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjust ALTER COLUMN TRAJTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjust ADD 
CONSTRAINT VS4TProjectVS4TARDebtAdjust FOREIGN KEY 
(
TRAJTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjustMB ALTER COLUMN TRJMTRJANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjustMB ADD 
CONSTRAINT VS4TARDebtAdjustVS4TARDebtAdjustMB FOREIGN KEY 
(
TRJMTRJANo
) REFERENCES VS4TARDebtAdjust (
TRAJNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARDebtAdjustMB ALTER COLUMN TRJMTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TARDebtAdjustMB ADD 
CONSTRAINT VS4TCurrencyVS4TARDebtAdjustMB FOREIGN KEY 
(
TRJMTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARImportantDay ALTER COLUMN TARITARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARImportantDay ADD 
CONSTRAINT VS4TARVS4TARImportantDay FOREIGN KEY 
(
TARITARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARImportantDay ALTER COLUMN TARITIMDCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARImportantDay ADD 
CONSTRAINT VS4TImportantDayVS4TARImportantDay FOREIGN KEY 
(
TARITIMDCode
) REFERENCES VS4TImportantDay (
TImDCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInquiry ALTER COLUMN TAQCTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInquiry ADD 
CONSTRAINT VS4TARVS4TARInquiry FOREIGN KEY 
(
TAQCTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInquiry ALTER COLUMN TAQCTIQCTIQRCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TARInquiry ALTER COLUMN TAQCTIQCLn INT NOT NULL 
GO

ALTER TABLE VS4TARInquiry ADD 
CONSTRAINT VS4TInquiryChoiceVS4TARInquiry FOREIGN KEY 
(
TAQCTIQCTIQRCode,TAQCTIQCLn
) REFERENCES VS4TInquiryChoice (
TIQCTIQRCodeTIQCLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoice ALTER COLUMN TIvoTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInvoice ADD 
CONSTRAINT VS4TARVS4TInvoice FOREIGN KEY 
(
TIvoTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoice ALTER COLUMN TIvoTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInvoice ADD 
CONSTRAINT VS4TProjectVS4TInvoice FOREIGN KEY 
(
TIvoTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoiceMB ALTER COLUMN TIoMTIvoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInvoiceMB ADD 
CONSTRAINT VS4TInvoiceVS4TInvoiceMB FOREIGN KEY 
(
TIoMTIvoNo
) REFERENCES VS4TARInvoice (
TIvoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoicePay ALTER COLUMN TIPyTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInvoicePay ADD 
CONSTRAINT VS4TCompanyBankVS4TInvoicePayment FOREIGN KEY 
(
TIPyTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoicePay ALTER COLUMN TIPyTIvoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARInvoicePay ADD 
CONSTRAINT VS4TInvoiceVS4TInvoicePayment FOREIGN KEY 
(
TIPyTIvoNo
) REFERENCES VS4TARInvoice (
TIvoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARInvoicePay ALTER COLUMN TIPyReceiveType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TARInvoicePay ADD 
CONSTRAINT VS4TPaymentTypeVS4TARInvoicePay FOREIGN KEY 
(
TIPyReceiveType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARMedia ALTER COLUMN TAMdTMedCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARMedia ADD 
CONSTRAINT VS4TMediaVS4TARMedia FOREIGN KEY 
(
TAMdTMedCode
) REFERENCES VS4TMedia (
TMedCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARMemberCard ALTER COLUMN TAMCTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARMemberCard ADD 
CONSTRAINT VS4TARVS4TARMemberCard FOREIGN KEY 
(
TAMCTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARMemberCard ALTER COLUMN TAMCTMCDCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TARMemberCard ADD 
CONSTRAINT VS4TMemberCardVS4TARMemberCard FOREIGN KEY 
(
TAMCTMCDCode
) REFERENCES VS4TMemberCard (
TMCDCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARReceipt ALTER COLUMN TAIHTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARReceipt ADD 
CONSTRAINT VS4TARVS4TARReceipt FOREIGN KEY 
(
TAIHTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARReceiptD ALTER COLUMN TAIRTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARReceiptD ADD 
CONSTRAINT VS4TARVS4TARReceiptD FOREIGN KEY 
(
TAIRTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARReceiptDMB ALTER COLUMN TRDMTAIRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARReceiptDMB ADD 
CONSTRAINT VS4TARReceiptDVS4TARReceiptDMB FOREIGN KEY 
(
TRDMTAIRNo
) REFERENCES VS4TARReceiptD (
TAIRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARReceiptMB ALTER COLUMN TREMTAIHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARReceiptMB ADD 
CONSTRAINT VS4TARReceiptVS4TARReceiptMB FOREIGN KEY 
(
TREMTAIHNo
) REFERENCES VS4TARReceipt (
TAIHNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARReceiptMBD ALTER COLUMN TRBDTREMTAIHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARReceiptMBD ALTER COLUMN TRBDTREMLn INT NOT NULL 
GO

ALTER TABLE VS4TARReceiptMBD ADD 
CONSTRAINT VS4TARReceiptMBVS4TARReceiptMBD FOREIGN KEY 
(
TRBDTREMTAIHNo,TRBDTREMLn
) REFERENCES VS4TARReceiptMB (
TREMTAIHNoTREMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVandReceipt ALTER COLUMN TRNRTRECNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVandReceipt ADD 
CONSTRAINT VS4TReceiptVS4TRVandReceipt FOREIGN KEY 
(
TRNRTRECNo
) REFERENCES VS4TReceipt (
TRECNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVandReceipt ALTER COLUMN TRNRTRVHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVandReceipt ADD 
CONSTRAINT VS4TReceiveVoucherVS4TRVandReceipt FOREIGN KEY 
(
TRNRTRVHNo
) REFERENCES VS4TARVoucher (
TRVHNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVDocRef ALTER COLUMN TRDRTRVHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVDocRef ADD 
CONSTRAINT VS4TReceiveVoucherVS4TRVDocRef FOREIGN KEY 
(
TRDRTRVHNo
) REFERENCES VS4TARVoucher (
TRVHNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVDocRefMB ALTER COLUMN TRVMTRDRTRVHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVDocRefMB ALTER COLUMN TRVMTRDRLn INT NOT NULL 
GO

ALTER TABLE VS4TARVDocRefMB ADD 
CONSTRAINT VS4TRVDocRefVS4TRVDocRefMB FOREIGN KEY 
(
TRVMTRDRTRVHNo,TRVMTRDRLn
) REFERENCES VS4TARVDocRef (
TRDRTRVHNoTRDRLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVoucher ALTER COLUMN TRVHTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVoucher ADD 
CONSTRAINT VS4TARVS4TReceiveVoucher FOREIGN KEY 
(
TRVHTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVoucher ALTER COLUMN TRVHTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVoucher ADD 
CONSTRAINT VS4TProjectVS4TARVoucher FOREIGN KEY 
(
TRVHTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVoucherPay ALTER COLUMN TRVRTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVoucherPay ADD 
CONSTRAINT VS4TCompanyBankVS4TRVReceive FOREIGN KEY 
(
TRVRTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVoucherPay ALTER COLUMN TRVRReceiveType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TARVoucherPay ADD 
CONSTRAINT VS4TPaymentTypeVS4TARVoucherPay FOREIGN KEY 
(
TRVRReceiveType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TARVoucherPay ALTER COLUMN TRVRTRVHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TARVoucherPay ADD 
CONSTRAINT VS4TReceiveVoucherVS4TRVReceive FOREIGN KEY 
(
TRVRTRVHNo
) REFERENCES VS4TARVoucher (
TRVHNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAsset ALTER COLUMN TAssTAseCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAsset ADD 
CONSTRAINT VS4TAssetSectionVS4TAsset FOREIGN KEY 
(
TAssTAseCode
) REFERENCES VS4TAssetSection (
TAseCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAsset ALTER COLUMN TAssTAsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAsset ADD 
CONSTRAINT VS4TAssetTypeVS4TAsset FOREIGN KEY 
(
TAssTAsTCode
) REFERENCES VS4TAssetType (
TAsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAsset2Alias ALTER COLUMN TA2ATAsACode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAsset2Alias ADD 
CONSTRAINT VS4TAssetAliasVS4TAsset2Alias FOREIGN KEY 
(
TA2ATAsACode
) REFERENCES VS4TAssetAlias (
TAsACode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAsset2Alias ALTER COLUMN TA2ATAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAsset2Alias ADD 
CONSTRAINT VS4TAssetVS4TAsset2Alias FOREIGN KEY 
(
TA2ATAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixCCL ALTER COLUMN TCCLTFITCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFixCCL ADD 
CONSTRAINT VS4TAssetFixTypeVS4TAssetFixCCL FOREIGN KEY 
(
TCCLTFITCode
) REFERENCES VS4TAssetFixType (
TFITCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixMB ALTER COLUMN TFSbTFstNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFixMB ADD 
CONSTRAINT VS4TAssetFixVS4TAssetFixMB FOREIGN KEY 
(
TFSbTFstNo
) REFERENCES VS4TAssetFix (
TFstNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixMB ALTER COLUMN TFSbTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFixMB ADD 
CONSTRAINT VS4TAssetVS4TAssetFixMB FOREIGN KEY 
(
TFSbTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixReq ALTER COLUMN TFRqTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFixReq ADD 
CONSTRAINT VS4TAssetVS4TAssetFixReq FOREIGN KEY 
(
TFRqTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixSub ALTER COLUMN TFssTFstNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFixSub ADD 
CONSTRAINT VS4TAssetFixVS4TAssetFixSub FOREIGN KEY 
(
TFssTFstNo
) REFERENCES VS4TAssetFix (
TFstNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFixSub ALTER COLUMN TFssTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TAssetFixSub ADD 
CONSTRAINT VS4TUnitVS4TAssetFixSub FOREIGN KEY 
(
TFssTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetFund ALTER COLUMN TAFdTAFtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetFund ADD 
CONSTRAINT VS4TAssetFundTypeVS4TAssetFund FOREIGN KEY 
(
TAFdTAFtCode
) REFERENCES VS4TAssetFundType (
TAFtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetMB ALTER COLUMN TAsbTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetMB ADD 
CONSTRAINT VS4TAssetVS4TAssetMB FOREIGN KEY 
(
TAsbTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetPMMB ALTER COLUMN TAFBTFITCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetPMMB ADD 
CONSTRAINT VS4TAssetFixTypeVS4TAssetPMMB FOREIGN KEY 
(
TAFBTFITCode
) REFERENCES VS4TAssetFixType (
TFITCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetPMMB ALTER COLUMN TAFBTAFPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetPMMB ADD 
CONSTRAINT VS4TAssetPMVS4TAssetPMMB FOREIGN KEY 
(
TAFBTAFPNo
) REFERENCES VS4TAssetPM (
TAFPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetPMMB ALTER COLUMN TAFBTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetPMMB ADD 
CONSTRAINT VS4TAssetVS4TAssetPMMB FOREIGN KEY 
(
TAFBTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetSection ALTER COLUMN TAseTAsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetSection ADD 
CONSTRAINT VS4TAssetTypeVS4TAssetSection FOREIGN KEY 
(
TAseTAsTCode
) REFERENCES VS4TAssetType (
TAsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetSub ALTER COLUMN TASuTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetSub ADD 
CONSTRAINT VS4TAssetVS4TAssetSub FOREIGN KEY 
(
TASuTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetTransMB ALTER COLUMN TATMTATfNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetTransMB ADD 
CONSTRAINT VS4TAssetTransVS4TAssetTransMB FOREIGN KEY 
(
TATMTATfNo
) REFERENCES VS4TAssetTrans (
TATfNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetWGMB ALTER COLUMN TAegTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetWGMB ADD 
CONSTRAINT VS4TAssetVS4TAssetWGMB FOREIGN KEY 
(
TAegTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetWGMB ALTER COLUMN TAegTAgtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetWGMB ADD 
CONSTRAINT VS4TAssetWorkGroupVS4TAssetWGMB FOREIGN KEY 
(
TAegTAgtCode
) REFERENCES VS4TAssetWorkGroup (
TAgtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TAssetWorkTime ALTER COLUMN TEntTAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TAssetWorkTime ADD 
CONSTRAINT VS4TAssetVS4TAssetWorkTime FOREIGN KEY 
(
TEntTAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankBranch ALTER COLUMN TBBrTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankBranch ADD 
CONSTRAINT VS4TBankVS4TBankBranch FOREIGN KEY 
(
TBBrTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankCardFee ALTER COLUMN TBCFTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankCardFee ADD 
CONSTRAINT VS4TBankVS4TBankCardFee FOREIGN KEY 
(
TBCFTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankCardFee ALTER COLUMN TBCFTPymCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TBankCardFee ADD 
CONSTRAINT VS4TPaymentVS4TBankCardFee FOREIGN KEY 
(
TBCFTPymCode
) REFERENCES VS4TPayment (
TPymCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankCheque ALTER COLUMN TBCqTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankCheque ADD 
CONSTRAINT VS4TBankVS4TBankCheque FOREIGN KEY 
(
TBCqTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankCreditCard ALTER COLUMN TBCDTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankCreditCard ADD 
CONSTRAINT VS4TBranchVS4TBankCreditCard FOREIGN KEY 
(
TBCDTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankCreditCard ALTER COLUMN TBCDTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankCreditCard ADD 
CONSTRAINT VS4TCompanyBankVS4TBankCreditCard FOREIGN KEY 
(
TBCDTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBankSlip ALTER COLUMN TBSLTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBankSlip ADD 
CONSTRAINT VS4TBankVS4TBankSlip FOREIGN KEY 
(
TBSLTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBOQ ALTER COLUMN TBOQTBQkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBOQ ADD 
CONSTRAINT VS4TBOQBookVS4TBOQ FOREIGN KEY 
(
TBOQTBQkCode
) REFERENCES VS4TBOQBook (
TBQkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBOQDL ALTER COLUMN TBQLTBQBTBOQNo NVARCHAR (50) NOT NULL 
GO

ALTER TABLE VS4TBOQDL ALTER COLUMN TBQLTBQBLn INT NOT NULL 
GO

ALTER TABLE VS4TBOQDL ADD 
CONSTRAINT VS4TBOQMBVS4TBOQDL FOREIGN KEY 
(
TBQLTBQBTBOQNo,TBQLTBQBLn
) REFERENCES VS4TBOQMB (
TBQBTBOQNoTBQBLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBOQMaterial ALTER COLUMN TBQMTBQBTBOQNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBOQMaterial ALTER COLUMN TBQMTBQBLn INT NOT NULL 
GO

ALTER TABLE VS4TBOQMaterial ADD 
CONSTRAINT VS4TBOQMBVS4TBOQMaterial FOREIGN KEY 
(
TBQMTBQBTBOQNo,TBQMTBQBLn
) REFERENCES VS4TBOQMB (
TBQBTBOQNoTBQBLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBOQMB ALTER COLUMN TBQBTBOQNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBOQMB ADD 
CONSTRAINT VS4TBOQVS4TBOQMB FOREIGN KEY 
(
TBQBTBOQNo
) REFERENCES VS4TBOQ (
TBOQNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBOQMethod ALTER COLUMN TBQRTBQBTBOQNo NVARCHAR (50) NOT NULL 
GO

ALTER TABLE VS4TBOQMethod ALTER COLUMN TBQRTBQBLn INT NOT NULL 
GO

ALTER TABLE VS4TBOQMethod ADD 
CONSTRAINT VS4TBOQMBVS4TBOQMethod FOREIGN KEY 
(
TBQRTBQBTBOQNo,TBQRTBQBLn
) REFERENCES VS4TBOQMB (
TBQBTBOQNoTBQBLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBranch ALTER COLUMN TBraTBrTAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBranch ADD 
CONSTRAINT VS4TBranchTypeVS4TBranch FOREIGN KEY 
(
TBraTBrTAlias
) REFERENCES VS4TBranchType (
TBrTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBranch ALTER COLUMN TBraTCmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBranch ADD 
CONSTRAINT VS4TCompanyVS4TBranch FOREIGN KEY 
(
TBraTCmpCode
) REFERENCES VS4TCompany (
TCmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBranch ALTER COLUMN TBraTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TBranch ADD 
CONSTRAINT VS4TCountryVS4TBranch FOREIGN KEY 
(
TBraTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBranchGroupMB ALTER COLUMN TBGMTBrGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBranchGroupMB ADD 
CONSTRAINT VS4TBranchGroupVS4TBranchGroupMB FOREIGN KEY 
(
TBGMTBrGCode
) REFERENCES VS4TBranchGroup (
TBrGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBranchGroupMB ALTER COLUMN TBGMTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBranchGroupMB ADD 
CONSTRAINT VS4TBranchVS4TBranchGroupMB FOREIGN KEY 
(
TBGMTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBrand ALTER COLUMN TBndTBnGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBrand ADD 
CONSTRAINT VS4TBrandGroupVS4TBrand FOREIGN KEY 
(
TBndTBnGCode
) REFERENCES VS4TBrandGroup (
TBnGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBrandGroup ALTER COLUMN TBnGTBnTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBrandGroup ADD 
CONSTRAINT VS4TBrandTypeVS4TBrandGroup FOREIGN KEY 
(
TBnGTBnTCode
) REFERENCES VS4TBrandType (
TBnTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBudget ALTER COLUMN TBDGTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TBudget ALTER COLUMN TBDGTACPID INT NOT NULL 
GO

ALTER TABLE VS4TBudget ADD 
CONSTRAINT VS4TAccountPeriodVS4TBudget FOREIGN KEY 
(
TBDGTACPTACYID,TBDGTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBudget ALTER COLUMN TBDGTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBudget ADD 
CONSTRAINT VS4TProjectVS4TBudget FOREIGN KEY 
(
TBDGTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBudgetMB ALTER COLUMN TBDMTACCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBudgetMB ADD 
CONSTRAINT VS4TACChartVS4TBudgetMB FOREIGN KEY 
(
TBDMTACCCode
) REFERENCES VS4TACChart (
TACCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBudgetMB ALTER COLUMN TBDMTBDGNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBudgetMB ADD 
CONSTRAINT VS4TBudgetVS4TBudgetMB FOREIGN KEY 
(
TBDMTBDGNo
) REFERENCES VS4TBudget (
TBDGNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TBusinessFlowMB ALTER COLUMN TBFMTBsFCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TBusinessFlowMB ADD 
CONSTRAINT VS4TBusinessFlowVS4TBusinessFlowMB FOREIGN KEY 
(
TBFMTBsFCode
) REFERENCES VS4TBusinessFlow (
TBsFCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCashDepositMB ALTER COLUMN TDPMTDPSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCashDepositMB ADD 
CONSTRAINT VS4TCashDepositVS4TCashDepositMB FOREIGN KEY 
(
TDPMTDPSNo
) REFERENCES VS4TCashDeposit (
TDPSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCashDepositMB ALTER COLUMN TDPMTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCashDepositMB ADD 
CONSTRAINT VS4TCompanyBankVS4TCashDepositMB FOREIGN KEY 
(
TDPMTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCashRequest ALTER COLUMN TCRQTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCashRequest ADD 
CONSTRAINT VS4TProjectVS4TCashRequest FOREIGN KEY 
(
TCRQTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCashRequestMB ALTER COLUMN TCRMTCRQNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCashRequestMB ADD 
CONSTRAINT VS4TCashRequestVS4TCashRequestMB FOREIGN KEY 
(
TCRMTCRQNo
) REFERENCES VS4TCashRequest (
TCRQNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCashRequestMB ALTER COLUMN TCRMTOEXCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCashRequestMB ADD 
CONSTRAINT VS4TOtherExpenseVS4TCashRequestMB FOREIGN KEY 
(
TCRMTOEXCode
) REFERENCES VS4TOtherExpense (
TOExCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCategoryMB ALTER COLUMN TCaMTCatCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCategoryMB ADD 
CONSTRAINT VS4TCategoryVS4TCategoryMB FOREIGN KEY 
(
TCaMTCatCode
) REFERENCES VS4TCategory (
TCatCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCategoryMB ALTER COLUMN TCaMTPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCategoryMB ADD 
CONSTRAINT VS4TPOSVS4TCategoryMB FOREIGN KEY 
(
TCaMTPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCategoryMBDwg ALTER COLUMN TCaDTCatCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCategoryMBDwg ADD 
CONSTRAINT VS4TCategoryVS4TCatagoryMBDwg FOREIGN KEY 
(
TCaDTCatCode
) REFERENCES VS4TCategory (
TCatCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCategoryMBDwg ALTER COLUMN TCaDTDwgCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCategoryMBDwg ADD 
CONSTRAINT VS4TDrawingVS4TCatagoryMBDwg FOREIGN KEY 
(
TCaDTDwgCode
) REFERENCES VS4TDrawing (
TDwgCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCertificateSub ALTER COLUMN TCeMTCerNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCertificateSub ADD 
CONSTRAINT VS4TCertificatedVS4TCertificatedMB FOREIGN KEY 
(
TCeMTCerNo
) REFERENCES VS4TCertificate (
TCerNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2IV ALTER COLUMN TR2ITCHRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2IV ADD 
CONSTRAINT VS4TChequeRecVS4TChequeRec2IV FOREIGN KEY 
(
TR2ITCHRNo
) REFERENCES VS4TChequeRec (
TCHRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2IV ALTER COLUMN TR2ITIPyTIvoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2IV ALTER COLUMN TR2ITIPyLn INT NOT NULL 
GO

ALTER TABLE VS4TChequeRec2IV ADD 
CONSTRAINT VS4TInvoicePaymentVS4TChequeRec2IV FOREIGN KEY 
(
TR2ITIPyTIvoNo,TR2ITIPyLn
) REFERENCES VS4TARInvoicePay (
TIPyTIvoNoTIPyLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2POS ALTER COLUMN TR2PTCHRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2POS ADD 
CONSTRAINT VS4TChequeRecVS4TChequeRec2POS FOREIGN KEY 
(
TR2PTCHRNo
) REFERENCES VS4TChequeRec (
TCHRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2POS ALTER COLUMN TR2PTPPyTPTANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2POS ALTER COLUMN TR2PTPPyLn INT NOT NULL 
GO

ALTER TABLE VS4TChequeRec2POS ADD 
CONSTRAINT VS4TPOSTransPayVS4TChequeRec2POS FOREIGN KEY 
(
TR2PTPPyTPTANo,TR2PTPPyLn
) REFERENCES VS4TPOSTransPay (
TPPyTPTANoTPPyLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2RV ALTER COLUMN TR2RTCHRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2RV ADD 
CONSTRAINT VS4TChequeRecVS4TChequeRec2RV FOREIGN KEY 
(
TR2RTCHRNo
) REFERENCES VS4TChequeRec (
TCHRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeRec2RV ALTER COLUMN TR2RTRVRTRVHNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeRec2RV ALTER COLUMN TR2RTRVRLn INT NOT NULL 
GO

ALTER TABLE VS4TChequeRec2RV ADD 
CONSTRAINT VS4TRVReceiveVS4TChequeRec2RV FOREIGN KEY 
(
TR2RTRVRTRVHNo,TR2RTRVRLn
) REFERENCES VS4TARVoucherPay (
TRVRTRVHNoTRVRLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeSub2IV ALTER COLUMN TS2ITPIPTIAPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeSub2IV ALTER COLUMN TS2ITPIPLn INT NOT NULL 
GO

ALTER TABLE VS4TChequeSub2IV ADD 
CONSTRAINT VS4TAPInvoicePayVS4TChequeSub2IV FOREIGN KEY 
(
TS2ITPIPTIAPNo,TS2ITPIPLn
) REFERENCES VS4TAPInvoicePay (
TPIPTIAPNoTPIPLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeSub2IV ALTER COLUMN TS2ITCHSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeSub2IV ADD 
CONSTRAINT VS4TChequeSubVS4TChequeSub2IV FOREIGN KEY 
(
TS2ITCHSNo
) REFERENCES VS4TChequeSub (
TCHSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeSub2PV ALTER COLUMN TS2PTPVPTAPVNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeSub2PV ALTER COLUMN TS2PTPVPLn INT NOT NULL 
GO

ALTER TABLE VS4TChequeSub2PV ADD 
CONSTRAINT VS4TAPVoucherPayVS4TChequeSub2PV FOREIGN KEY 
(
TS2PTPVPTAPVNo,TS2PTPVPLn
) REFERENCES VS4TAPVoucherPay (
TPVPTAPVNoTPVPLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TChequeSub2PV ALTER COLUMN TS2PTCHSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TChequeSub2PV ADD 
CONSTRAINT VS4TChequeSubVS4TChequeSub2PV FOREIGN KEY 
(
TS2PTCHSNo
) REFERENCES VS4TChequeSub (
TCHSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCode ALTER COLUMN TCodTCoGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCode ADD 
CONSTRAINT VS4TCodeGroupVS4TCode FOREIGN KEY 
(
TCodTCoGAlias
) REFERENCES VS4TCodeGroup (
TCoGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommand ALTER COLUMN TCmdTCmGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommand ADD 
CONSTRAINT VS4TCommandGroupVS4TCommand FOREIGN KEY 
(
TCmdTCmGAlias
) REFERENCES VS4TCommandGroup (
TCmGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissionSub ALTER COLUMN TCmrTComNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissionSub ADD 
CONSTRAINT VS4TCommissionVS4TCommissionSub FOREIGN KEY 
(
TCmrTComNo
) REFERENCES VS4TCommission (
TComNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissionSub ALTER COLUMN TCmrTCmsCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissionSub ADD 
CONSTRAINT VS4TCommissorVS4TCommissionSub FOREIGN KEY 
(
TCmrTCmsCode
) REFERENCES VS4TCommissor (
TCmsCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissionSub ALTER COLUMN TCmrTFoGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissionSub ADD 
CONSTRAINT VS4TFormulaGroupVS4TCommissionSub FOREIGN KEY 
(
TCmrTFoGCode
) REFERENCES VS4TFormulaGroup (
TFoGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissor ALTER COLUMN TCmsTCmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissor ADD 
CONSTRAINT VS4TCommissorTypeVS4TCommissor FOREIGN KEY 
(
TCmsTCmTCode
) REFERENCES VS4TCommissorType (
TCmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissorAP ALTER COLUMN TCAPTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissorAP ADD 
CONSTRAINT VS4TAPVS4TCommissorAP FOREIGN KEY 
(
TCAPTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissorAP ALTER COLUMN TCAPTCmsCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissorAP ADD 
CONSTRAINT VS4TCommissorVS4TCommissorAP FOREIGN KEY 
(
TCAPTCmsCode
) REFERENCES VS4TCommissor (
TCmsCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissorAR ALTER COLUMN TCARTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissorAR ADD 
CONSTRAINT VS4TARVS4TCommissorAR FOREIGN KEY 
(
TCARTAPNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCommissorAR ALTER COLUMN TCARTCmsCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCommissorAR ADD 
CONSTRAINT VS4TCommissorVS4TCommissorAR FOREIGN KEY 
(
TCARTCmsCode
) REFERENCES VS4TCommissor (
TCmsCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompany ALTER COLUMN TCmpTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TCompany ADD 
CONSTRAINT VS4TCountryVS4TCompany FOREIGN KEY 
(
TCmpTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompanyBank ALTER COLUMN TCBBTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompanyBank ADD 
CONSTRAINT VS4TBankVS4TCompanyBank FOREIGN KEY 
(
TCBBTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompanyBank ALTER COLUMN TCBBTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompanyBank ADD 
CONSTRAINT VS4TBranchVS4TCompanyBank FOREIGN KEY 
(
TCBBTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompanyBusType ALTER COLUMN TCTYTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompanyBusType ADD 
CONSTRAINT VS4TBusinessTypeVS4TCompanyBusType FOREIGN KEY 
(
TCTYTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompanyBusType ALTER COLUMN TCTYTCmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompanyBusType ADD 
CONSTRAINT VS4TCompanyVS4TCompanyBusType FOREIGN KEY 
(
TCTYTCmpCode
) REFERENCES VS4TCompany (
TCmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompanyContact ALTER COLUMN TCpCTCmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompanyContact ADD 
CONSTRAINT VS4TCompanyVS4TCompanyContact FOREIGN KEY 
(
TCpCTCmpCode
) REFERENCES VS4TCompany (
TCmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompetitor ALTER COLUMN TCptTBsMCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompetitor ADD 
CONSTRAINT VS4TBusinessMajorVS4TCompetitor FOREIGN KEY 
(
TCptTBsMCode
) REFERENCES VS4TBusinessMajor (
TBsMCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompetitor ALTER COLUMN TCptTBsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompetitor ADD 
CONSTRAINT VS4TBusinessTypeVS4TCompetitor FOREIGN KEY 
(
TCptTBsTCode
) REFERENCES VS4TBusinessType (
TBsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompetitor ALTER COLUMN TCptTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TCompetitor ADD 
CONSTRAINT VS4TCountryVS4TCompetitor FOREIGN KEY 
(
TCptTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompetSection ALTER COLUMN TCPSTCPTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompetSection ADD 
CONSTRAINT VS4TCompetitorVS4TCompetSection FOREIGN KEY 
(
TCPSTCPTCode
) REFERENCES VS4TCompetitor (
TCptCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TCompetSection ALTER COLUMN TCPSTPSECode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TCompetSection ADD 
CONSTRAINT VS4TProductSectionVS4TCompetSection FOREIGN KEY 
(
TCPSTPSECode
) REFERENCES VS4TProductSection (
TPSECode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TComSaleMB ALTER COLUMN TCsBTCosNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TComSaleMB ADD 
CONSTRAINT VS4TComSaleVS4TComSaleMB FOREIGN KEY 
(
TCsBTCosNo
) REFERENCES VS4TComSale (
TCosNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TContactMB ALTER COLUMN TCnMTCmsCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TContactMB ADD 
CONSTRAINT VS4TCommissorVS4TContactMB FOREIGN KEY 
(
TCnMTCmsCode
) REFERENCES VS4TCommissor (
TCmsCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TContactMB ALTER COLUMN TCnMTCntNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TContactMB ADD 
CONSTRAINT VS4TContactVS4TContactMB FOREIGN KEY 
(
TCnMTCntNo
) REFERENCES VS4TContact (
TCntNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TContactMB ALTER COLUMN TCnMTFoGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TContactMB ADD 
CONSTRAINT VS4TFormulaGroupVS4TContactMB FOREIGN KEY 
(
TCnMTFoGCode
) REFERENCES VS4TFormulaGroup (
TFoGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDeliveryINMB ALTER COLUMN TDIMTIAPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDeliveryINMB ADD 
CONSTRAINT VS4TAPInvoiceVS4TDeliveryINMB FOREIGN KEY 
(
TDIMTIAPNo
) REFERENCES VS4TAPInvoice (
TIAPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDeliveryINMB ALTER COLUMN TDIMTDCINo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDeliveryINMB ADD 
CONSTRAINT VS4TDeliveryINVS4TDeliveryINMB FOREIGN KEY 
(
TDIMTDCINo
) REFERENCES VS4TDeliveryIN (
TDCINo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDeliveryOutMB ALTER COLUMN TDOMTIvoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDeliveryOutMB ADD 
CONSTRAINT VS4TARInvoiceVS4TDelvieryOutMB FOREIGN KEY 
(
TDOMTIvoNo
) REFERENCES VS4TARInvoice (
TIvoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDeliveryOutMB ALTER COLUMN TDOMTDCONo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDeliveryOutMB ADD 
CONSTRAINT VS4TDeliveryOutVS4TDelvieryOutMB FOREIGN KEY 
(
TDOMTDCONo
) REFERENCES VS4TDeliveryOut (
TDCONo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDepartment ALTER COLUMN TDepTDivCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDepartment ADD 
CONSTRAINT VS4TDivisionVS4TDepartment FOREIGN KEY 
(
TDepTDivCode
) REFERENCES VS4TDivision (
TDivCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDepositChq ALTER COLUMN TCDCTDPMTDPSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDepositChq ALTER COLUMN TCDCTDPMLn INT NOT NULL 
GO

ALTER TABLE VS4TDepositChq ADD 
CONSTRAINT VS4TCashDepositMBVS4TDepositChq FOREIGN KEY 
(
TCDCTDPMTDPSNo,TCDCTDPMLn
) REFERENCES VS4TCashDepositMB (
TDPMTDPSNoTDPMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDepositChq ALTER COLUMN TCDCTCHRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDepositChq ADD 
CONSTRAINT VS4TChequeRecVS4TDepositChq FOREIGN KEY 
(
TCDCTCHRNo
) REFERENCES VS4TChequeRec (
TCHRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDepositChqSub ALTER COLUMN TCDQTDPMTDPSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDepositChqSub ALTER COLUMN TCDQTDPMLn INT NOT NULL 
GO

ALTER TABLE VS4TDepositChqSub ADD 
CONSTRAINT VS4TCashDepositMBVS4TDepositChqSub FOREIGN KEY 
(
TCDQTDPMTDPSNo,TCDQTDPMLn
) REFERENCES VS4TCashDepositMB (
TDPMTDPSNoTDPMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDepositChqSub ALTER COLUMN TCDQTCHSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDepositChqSub ADD 
CONSTRAINT VS4TChequeSubVS4TDepositChqSub FOREIGN KEY 
(
TCDQTCHSNo
) REFERENCES VS4TChequeSub (
TCHSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDistrict ALTER COLUMN TSPvTPrvCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TDistrict ADD 
CONSTRAINT VS4TProvinceVS4TDistrict FOREIGN KEY 
(
TSPvTPrvCode
) REFERENCES VS4TProvince (
TPrvCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDivision ALTER COLUMN TDivTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDivision ADD 
CONSTRAINT VS4TBranchVS4TDivision FOREIGN KEY 
(
TDivTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDOBoxSetMB ALTER COLUMN TDSMTDBSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDOBoxSetMB ADD 
CONSTRAINT VS4TDOBoxSetVS4TDOBoxSetMB FOREIGN KEY 
(
TDSMTDBSNo
) REFERENCES VS4TDOBoxSet (
TDBSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDOBoxSetNo ALTER COLUMN TDSNTDBSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDOBoxSetNo ADD 
CONSTRAINT VS4TDOBoxSetVS4TDOBoxSetNo FOREIGN KEY 
(
TDSNTDBSNo
) REFERENCES VS4TDOBoxSet (
TDBSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDOMB ALTER COLUMN TDymTPdyNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDOMB ADD 
CONSTRAINT VS4TProDeliveryDocVS4TProDeliveryMB FOREIGN KEY 
(
TDymTPdyNo
) REFERENCES VS4TDO (
TPdyNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDrawingImage ALTER COLUMN TDImTDwgCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDrawingImage ADD 
CONSTRAINT VS4TDrawingVS4TDrawingImage FOREIGN KEY 
(
TDImTDwgCode
) REFERENCES VS4TDrawing (
TDwgCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TDrawingMB ALTER COLUMN TDwMTDwgCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TDrawingMB ADD 
CONSTRAINT VS4TDrawingVS4TDrawingMB FOREIGN KEY 
(
TDwMTDwgCode
) REFERENCES VS4TDrawing (
TDwgCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpAddMoney ALTER COLUMN TAmyTAMTAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpAddMoney ADD 
CONSTRAINT VS4TEmpAddMoneyTYVS4TEmpAddMoney FOREIGN KEY 
(
TAmyTAMTAlias
) REFERENCES VS4TEmpAddMoneyTY (
TAMTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpAmassType ALTER COLUMN TEATTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpAmassType ADD 
CONSTRAINT VS4TBranchVS4TEmpAmassType FOREIGN KEY 
(
TEATTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpAmassType ALTER COLUMN TEATTDivCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpAmassType ADD 
CONSTRAINT VS4TDivisionVS4TEmpAmassType FOREIGN KEY 
(
TEATTDivCode
) REFERENCES VS4TDivision (
TDivCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpAmassType ALTER COLUMN TEATTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpAmassType ADD 
CONSTRAINT VS4TEmployeeTypeVS4TEmpAmassType FOREIGN KEY 
(
TEATTEmTCode
) REFERENCES VS4TEmployeeType (
TEmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpAmassType ALTER COLUMN TEATTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpAmassType ADD 
CONSTRAINT VS4TEmployeeVS4TEmpAmassType FOREIGN KEY 
(
TEATTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpBuddy ALTER COLUMN TEBuTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpBuddy ADD 
CONSTRAINT VS4TEmployeeVS4TEmpBuddy FOREIGN KEY 
(
TEBuTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpChild ALTER COLUMN TEcdTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpChild ADD 
CONSTRAINT VS4TEmployeeVS4TEmpChild FOREIGN KEY 
(
TEcdTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpCollateFund ALTER COLUMN TEcFTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpCollateFund ADD 
CONSTRAINT VS4TEmployeeVS4TEmpCollateFund FOREIGN KEY 
(
TEcFTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpCollateral ALTER COLUMN TEclTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpCollateral ADD 
CONSTRAINT VS4TEmployeeVS4TEmpCollateral FOREIGN KEY 
(
TEclTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpContact ALTER COLUMN TCttTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpContact ADD 
CONSTRAINT VS4TEmployeeVS4TEmpContact FOREIGN KEY 
(
TCttTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpHisEdu ALTER COLUMN THedTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpHisEdu ADD 
CONSTRAINT VS4TEmployeeVS4TEmpHisEdu FOREIGN KEY 
(
THedTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpHisProduce ALTER COLUMN TEHSTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpHisProduce ADD 
CONSTRAINT VS4TEmployeeVS4TEmpHisProduce FOREIGN KEY 
(
TEHSTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpHisPunish ALTER COLUMN TEHUTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpHisPunish ADD 
CONSTRAINT VS4TEmployeeVS4TEmpHisPunish FOREIGN KEY 
(
TEHUTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpHisPunish ALTER COLUMN TEHUTEPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpHisPunish ADD 
CONSTRAINT VS4TEmpPunishVS4TEmpHisPunish FOREIGN KEY 
(
TEHUTEPNCode
) REFERENCES VS4TEmpPunish (
TEPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpHisWork ALTER COLUMN THwkTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpHisWork ADD 
CONSTRAINT VS4TEmployeeVS4TEmpHisWork FOREIGN KEY 
(
THwkTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpIncomeMB ALTER COLUMN TEwoTAmyCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpIncomeMB ADD 
CONSTRAINT VS4TEmpAddMoneyVS4TEmpIncomeMB FOREIGN KEY 
(
TEwoTAmyCode
) REFERENCES VS4TEmpAddMoney (
TAmyCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpIncomeMB ALTER COLUMN TEwoTEidNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpIncomeMB ADD 
CONSTRAINT VS4TEmpIncomeDocVS4TEmpIncomeMB FOREIGN KEY 
(
TEwoTEidNo
) REFERENCES VS4TEmpIncomeDoc (
TEidNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpIncomeMB ALTER COLUMN TEwoTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpIncomeMB ADD 
CONSTRAINT VS4TEmployeeVS4TEmpIncomeMB FOREIGN KEY 
(
TEwoTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpLeave ALTER COLUMN TEpaTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpLeave ADD 
CONSTRAINT VS4TEmployeeVS4TEmpLeaveDoc FOREIGN KEY 
(
TEpaTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpLeaveAllow ALTER COLUMN TELATEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpLeaveAllow ADD 
CONSTRAINT VS4TEmployeeVS4TEmpLeaveAllow FOREIGN KEY 
(
TELATEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpLeaveMB ALTER COLUMN TElbTEpaNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpLeaveMB ADD 
CONSTRAINT VS4TEmpLeaveDocVS4TEmpLeaveMB FOREIGN KEY 
(
TElbTEpaNo
) REFERENCES VS4TEmpLeave (
TEpaNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpLeaveMB ALTER COLUMN TElbTLvtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpLeaveMB ADD 
CONSTRAINT VS4TEmpLeaveTypeVS4TEmpLeaveMB FOREIGN KEY 
(
TElbTLvtCode
) REFERENCES VS4TEmpLeaveType (
TLvtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee ALTER COLUMN TEmpTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee ADD 
CONSTRAINT VS4TBranchVS4TEmployee FOREIGN KEY 
(
TEmpTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee ALTER COLUMN TEmpTDivCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee ADD 
CONSTRAINT VS4TDivisionVS4TEmployee FOREIGN KEY 
(
TEmpTDivCode
) REFERENCES VS4TDivision (
TDivCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee ALTER COLUMN TEmpTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee ADD 
CONSTRAINT VS4TEmployeeTypeVS4TEmployee FOREIGN KEY 
(
TEmpTEmTCode
) REFERENCES VS4TEmployeeType (
TEmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee ALTER COLUMN TEmpTWPDCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee ADD 
CONSTRAINT VS4TEmpWorkPeriodVS4TEmployee FOREIGN KEY 
(
TEmpTWPDCode
) REFERENCES VS4TEmpWorkPeriod (
TWPDCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee ALTER COLUMN TEmpTPstCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee ADD 
CONSTRAINT VS4TPositionVS4TEmployee FOREIGN KEY 
(
TEmpTPstCode
) REFERENCES VS4TPosition (
TPstCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployee2 ALTER COLUMN TEm2TEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployee2 ADD 
CONSTRAINT VS4TEmployeeVS4TEmployee2 FOREIGN KEY 
(
TEm2TEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeBank ALTER COLUMN TEmBTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeBank ADD 
CONSTRAINT VS4TBankVS4TEmployeeBank FOREIGN KEY 
(
TEmBTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeBank ALTER COLUMN TEmBTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeBank ADD 
CONSTRAINT VS4TEmployeeVS4TEmployeeBank FOREIGN KEY 
(
TEmBTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeGrpMB ALTER COLUMN TEGMTEgdNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeGrpMB ADD 
CONSTRAINT VS4TEmpGroupDocVS4TEmployeeGrpMB FOREIGN KEY 
(
TEGMTEgdNo
) REFERENCES VS4TEmpGroupDoc (
TEgdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeGrpMB ALTER COLUMN TEGMTEmGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeGrpMB ADD 
CONSTRAINT VS4TEmployeeGroupVS4TEmployeeGrpMB FOREIGN KEY 
(
TEGMTEmGCode
) REFERENCES VS4TEmployeeGroup (
TEmGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeGrpMB ALTER COLUMN TEGMTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeGrpMB ADD 
CONSTRAINT VS4TEmployeeVS4TEmployeeGrpMB FOREIGN KEY 
(
TEGMTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeGrpMB ALTER COLUMN TEGMTPgpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeGrpMB ADD 
CONSTRAINT VS4TPositionGroupVS4TEmployeeGrpMB FOREIGN KEY 
(
TEGMTPgpCode
) REFERENCES VS4TPositionGroup (
TPgpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmployeeTypeSL ALTER COLUMN TGSlTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmployeeTypeSL ADD 
CONSTRAINT VS4TEmployeeTypeVS4TGlobalSlip FOREIGN KEY 
(
TGSlTEmTCode
) REFERENCES VS4TEmployeeType (
TEmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpParent ALTER COLUMN TEpPTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpParent ADD 
CONSTRAINT VS4TEmployeeVS4TEmpParent FOREIGN KEY 
(
TEpPTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSalary ALTER COLUMN TSalTAmyCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSalary ADD 
CONSTRAINT VS4TEmpAddMoneyVS4TEmpSalary FOREIGN KEY 
(
TSalTAmyCode
) REFERENCES VS4TEmpAddMoney (
TAmyCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSalary ALTER COLUMN TSalTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSalary ADD 
CONSTRAINT VS4TEmployeeVS4TEmpSalary FOREIGN KEY 
(
TSalTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSlipDoc ALTER COLUMN TEpsTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSlipDoc ADD 
CONSTRAINT VS4TEmployeeVS4TEmpSlipDoc FOREIGN KEY 
(
TEpsTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSlipDoc ALTER COLUMN TEpsTSAPTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSlipDoc ALTER COLUMN TEpsTSaPDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TEmpSlipDoc ADD 
CONSTRAINT VS4TEmpSlipPeriodVS4TEmpSlipDoc FOREIGN KEY 
(
TEpsTSAPTEmTCode,TEpsTSaPDate
) REFERENCES VS4TEmpSlipPeriod (
TSaPTEmTCodeTSaPDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSlipMB ALTER COLUMN TSmbTAmyCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSlipMB ADD 
CONSTRAINT VS4TEmpAddMoneyVS4TEmpSlipMB FOREIGN KEY 
(
TSmbTAmyCode
) REFERENCES VS4TEmpAddMoney (
TAmyCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSlipMB ALTER COLUMN TSmbTEpsNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSlipMB ALTER COLUMN TSmbTEpsCheckGroup INT NOT NULL 
GO

ALTER TABLE VS4TEmpSlipMB ADD 
CONSTRAINT VS4TEmpSlipDocVS4TEmpSlipMB FOREIGN KEY 
(
TSmbTEpsNo,TSmbTEpsCheckGroup
) REFERENCES VS4TEmpSlipDoc (
TEpsNoTEpsCheckGroup
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSlipPeriod ALTER COLUMN TSaPTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSlipPeriod ADD 
CONSTRAINT VS4TEmployeeTypeVS4TEmpSlipPeriod FOREIGN KEY 
(
TSaPTEmTCode
) REFERENCES VS4TEmployeeType (
TEmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpSpecial ALTER COLUMN TSplTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpSpecial ADD 
CONSTRAINT VS4TEmployeeVS4TEmpSpecial FOREIGN KEY 
(
TSplTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTimeChk ALTER COLUMN TEtcTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTimeChk ADD 
CONSTRAINT VS4TEmployeeVS4TEmpTimeChkDoc FOREIGN KEY 
(
TEtcTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTimeChk ALTER COLUMN TEtcTSAPTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTimeChk ALTER COLUMN TEtcTSaPDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TEmpTimeChk ADD 
CONSTRAINT VS4TEmpSlipPeriodVS4TEmpTimeChkDoc FOREIGN KEY 
(
TEtcTSAPTEmTCode,TEtcTSaPDate
) REFERENCES VS4TEmpSlipPeriod (
TSaPTEmTCodeTSaPDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTimeChkMB ALTER COLUMN TTCKTEtcNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTimeChkMB ADD 
CONSTRAINT VS4TEmpTimeChkDocVS4TEmpTimeChk FOREIGN KEY 
(
TTCKTEtcNo
) REFERENCES VS4TEmpTimeChk (
TEtcNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTipRate ALTER COLUMN TETRTEmTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTipRate ADD 
CONSTRAINT VS4TEmployeeTypeVS4TEmpTipRate FOREIGN KEY 
(
TETRTEmTCode
) REFERENCES VS4TEmployeeType (
TEmTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTrainingMB ALTER COLUMN TETmTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTrainingMB ADD 
CONSTRAINT VS4TEmployeeVS4TEmpTrainingMB FOREIGN KEY 
(
TETmTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTrainingMB ALTER COLUMN TETmTETrNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTrainingMB ADD 
CONSTRAINT VS4TEmpTrainingVS4TEmpTrainingMB FOREIGN KEY 
(
TETmTETrNo
) REFERENCES VS4TEmpTraining (
TETrNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpTrainingMB ALTER COLUMN TETmTTrCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpTrainingMB ADD 
CONSTRAINT VS4TTrainingCourseVS4TEmpTrainingMB FOREIGN KEY 
(
TETmTTrCCode
) REFERENCES VS4TTrainingCourse (
TTrCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpUpSalaryMB ALTER COLUMN TEUMTEUSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpUpSalaryMB ADD 
CONSTRAINT VS4TEmpUpSalaryVS4TEmpUpSalaryMB FOREIGN KEY 
(
TEUMTEUSNo
) REFERENCES VS4TEmpUpSalary (
TEUSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpWelfareMB ALTER COLUMN TEWMTEWlNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpWelfareMB ADD 
CONSTRAINT VS4TEmpWelfareVS4TEmpWelfareMB FOREIGN KEY 
(
TEWMTEWlNo
) REFERENCES VS4TEmpWelfare (
TEWlNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpWelfareMB ALTER COLUMN TEWMTWelCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpWelfareMB ADD 
CONSTRAINT VS4TWelfareVS4TEmpWelfareMB FOREIGN KEY 
(
TEWMTWelCode
) REFERENCES VS4TWelfare (
TWelCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpWorkCountMB ALTER COLUMN TECMTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpWorkCountMB ADD 
CONSTRAINT VS4TEmployeeVS4TEmpWorkCountMB FOREIGN KEY 
(
TECMTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpWorkCountMB ALTER COLUMN TECMTEWCNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpWorkCountMB ADD 
CONSTRAINT VS4TEmpWorkCountVS4TEmpWorkCountMB FOREIGN KEY 
(
TECMTEWCNo
) REFERENCES VS4TEmpWorkCount (
TEWCNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TEmpWorkTime ALTER COLUMN TWPTTWPDCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TEmpWorkTime ADD 
CONSTRAINT VS4TEmpWorkPeriodVS4TEmpWorkTime FOREIGN KEY 
(
TWPTTWPDCode
) REFERENCES VS4TEmpWorkPeriod (
TWPDCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TExchangeRate ALTER COLUMN TExRTBnkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TExchangeRate ADD 
CONSTRAINT VS4TBankVS4TExchangeRate FOREIGN KEY 
(
TExRTBnkCode
) REFERENCES VS4TBank (
TBnkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TExchangeRate ALTER COLUMN TExRTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TExchangeRate ADD 
CONSTRAINT VS4TCurrencyVS4TExchangeRate FOREIGN KEY 
(
TExRTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TExchangeRate ALTER COLUMN TExRTExcNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TExchangeRate ADD 
CONSTRAINT VS4TExchangeVS4TExchangeRate FOREIGN KEY 
(
TExRTExcNo
) REFERENCES VS4TExchange (
TExcNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFlight ALTER COLUMN TFliTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFlight ADD 
CONSTRAINT VS4TARVS4TFlight FOREIGN KEY 
(
TFliTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFlightEmployee ALTER COLUMN TFlETFliNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFlightEmployee ADD 
CONSTRAINT VS4TFlightVS4TFlightEmployee FOREIGN KEY 
(
TFlETFliNo
) REFERENCES VS4TFlight (
TFliNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFlightGuide ALTER COLUMN TFlGTFliNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFlightGuide ADD 
CONSTRAINT VS4TFlightVS4TFlightGuide FOREIGN KEY 
(
TFlGTFliNo
) REFERENCES VS4TFlight (
TFliNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFlightVehicle ALTER COLUMN TFVhTFliNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFlightVehicle ADD 
CONSTRAINT VS4TFlightVS4TFlightVehicle FOREIGN KEY 
(
TFVhTFliNo
) REFERENCES VS4TFlight (
TFliNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFlightVehicle ALTER COLUMN TFVhTVeTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFlightVehicle ADD 
CONSTRAINT VS4TVehicleTypeVS4TFlightVehicle FOREIGN KEY 
(
TFVhTVeTCode
) REFERENCES VS4TVehicleType (
TVeTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaMap ALTER COLUMN TFmMTFoGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaMap ADD 
CONSTRAINT VS4TFormulaGroupVS4TFormulaMap FOREIGN KEY 
(
TFmMTFoGCode
) REFERENCES VS4TFormulaGroup (
TFoGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaPro ALTER COLUMN TFcPTForCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaPro ADD 
CONSTRAINT VS4TFormulaVS4TFormulaPro FOREIGN KEY 
(
TFcPTForCode
) REFERENCES VS4TFormula (
TForCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaScript ALTER COLUMN TFuSTFcPTForCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaScript ALTER COLUMN TFuSTFcPCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaScript ADD 
CONSTRAINT VS4TFormulaProVS4TFormulaScript FOREIGN KEY 
(
TFuSTFcPTForCode,TFuSTFcPCode
) REFERENCES VS4TFormulaPro (
TFcPTForCodeTFcPCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaSub ALTER COLUMN TFmSTForCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaSub ADD 
CONSTRAINT VS4TFormulaVS4TFormulaSub FOREIGN KEY 
(
TFmSTForCode
) REFERENCES VS4TFormula (
TForCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaSubCell ALTER COLUMN TFSCTFmSID INT NOT NULL 
GO

ALTER TABLE VS4TFormulaSubCell ADD 
CONSTRAINT VS4TFormulaSubVS4TFormulaSubCell FOREIGN KEY 
(
TFSCTFmSID
) REFERENCES VS4TFormulaSub (
TFmSID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaSystem ALTER COLUMN TFcSTForCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaSystem ADD 
CONSTRAINT VS4TFormulaVS4TFormulaSystem FOREIGN KEY 
(
TFcSTForCode
) REFERENCES VS4TFormula (
TForCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFormulaUser ALTER COLUMN TFuUTForCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFormulaUser ADD 
CONSTRAINT VS4TFormulaVS4TFormulaUser FOREIGN KEY 
(
TFuUTForCode
) REFERENCES VS4TFormula (
TForCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TFundRate ALTER COLUMN TFuRTFunAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TFundRate ADD 
CONSTRAINT VS4TFundVS4TFundRate FOREIGN KEY 
(
TFuRTFunAlias
) REFERENCES VS4TFund (
TFunAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTrans ALTER COLUMN TGLTTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTrans ADD 
CONSTRAINT VS4TBranchVS4TGLTrans FOREIGN KEY 
(
TGLTTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTrans ALTER COLUMN TGLTTGLBCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTrans ADD 
CONSTRAINT VS4TGLBookVS4TGLTrans FOREIGN KEY 
(
TGLTTGLBCode
) REFERENCES VS4TGLBook (
TGLBCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTrans ALTER COLUMN TGLTTGLBCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTrans ADD 
CONSTRAINT VS4TGLBookVS4TGLTrans1 FOREIGN KEY 
(
TGLTTGLBCode
) REFERENCES VS4TGLBook (
TGLBCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTrans ALTER COLUMN TGLTTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTrans ADD 
CONSTRAINT VS4TProjectVS4TGLTrans FOREIGN KEY 
(
TGLTTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTACCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ADD 
CONSTRAINT VS4TACChartVS4TGLTransMove FOREIGN KEY 
(
TGTMTACCCode
) REFERENCES VS4TACChart (
TACCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTACPID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ADD 
CONSTRAINT VS4TAccountPeriodVS4TGLTransMove FOREIGN KEY 
(
TGTMTACPTACYID,TGTMTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTACPID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ADD 
CONSTRAINT VS4TAccountPeriodVS4TGLTransMove1 FOREIGN KEY 
(
TGTMTACPTACYID,TGTMTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransMove ALTER COLUMN TGTMTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransMove ADD 
CONSTRAINT VS4TBranchVS4TGLTransMove FOREIGN KEY 
(
TGTMTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTACCCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ADD 
CONSTRAINT VS4TACChartVS4TGLTransSub FOREIGN KEY 
(
TGTSTACCCode
) REFERENCES VS4TACChart (
TACCCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTACPTACYID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTACPID INT NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ADD 
CONSTRAINT VS4TAccountPeriodVS4TGLTransSub FOREIGN KEY 
(
TGTSTACPTACYID,TGTSTACPID
) REFERENCES VS4TAccountPeriod (
TACPTACYIDTACPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ADD 
CONSTRAINT VS4TBranchVS4TGLTransSub FOREIGN KEY 
(
TGTSTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTGLTNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ADD 
CONSTRAINT VS4TGLTransVS4TGLTransSub FOREIGN KEY 
(
TGTSTGLTNo
) REFERENCES VS4TGLTrans (
TGLTNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGLTransSub ALTER COLUMN TGTSTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TGLTransSub ADD 
CONSTRAINT VS4TProjectVS4TGLTransSub FOREIGN KEY 
(
TGTSTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGovPaymentMB ALTER COLUMN TGvMTGvPMonth INT NOT NULL 
GO

ALTER TABLE VS4TGovPaymentMB ALTER COLUMN TGvMTGvPYear INT NOT NULL 
GO

ALTER TABLE VS4TGovPaymentMB ALTER COLUMN TGvMTGvPType INT NOT NULL 
GO

ALTER TABLE VS4TGovPaymentMB ADD 
CONSTRAINT VS4TGovPaymentVS4TGovPaymentMB FOREIGN KEY 
(
TGvMTGvPMonth,TGvMTGvPYear,TGvMTGvPType
) REFERENCES VS4TGovPayment (
TGvPMonthTGvPYearTGvPType
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGroupMB ALTER COLUMN TGrMTGroID INT NOT NULL 
GO

ALTER TABLE VS4TGroupMB ADD 
CONSTRAINT VS4TGroupVS4TGroupMB FOREIGN KEY 
(
TGrMTGroID
) REFERENCES VS4TGroup (
TGroID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGroupMB ALTER COLUMN TGrMTUsrID INT NOT NULL 
GO

ALTER TABLE VS4TGroupMB ADD 
CONSTRAINT VS4TUserVS4TGroupMB FOREIGN KEY 
(
TGrMTUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGroupMB ALTER COLUMN TGrMTUsrID INT NOT NULL 
GO

ALTER TABLE VS4TGroupMB ADD 
CONSTRAINT VS4TUserVS4TGroupMB1 FOREIGN KEY 
(
TGrMTUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TGroupPermiss ALTER COLUMN TGrPTGroID INT NOT NULL 
GO

ALTER TABLE VS4TGroupPermiss ADD 
CONSTRAINT VS4TGroupVS4TGroupPermiss FOREIGN KEY 
(
TGrPTGroID
) REFERENCES VS4TGroup (
TGroID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4THostProfile ALTER COLUMN THPfTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4THostProfile ADD 
CONSTRAINT VS4TBranchVS4THostProfile FOREIGN KEY 
(
THPfTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4THostProfileMB ALTER COLUMN THPMTHPfCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4THostProfileMB ADD 
CONSTRAINT VS4THostProfileVS4THostProfileMB FOREIGN KEY 
(
THPMTHPfCode
) REFERENCES VS4THostProfile (
THPfCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInCorpMB ALTER COLUMN TICMTCmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInCorpMB ADD 
CONSTRAINT VS4TCompanyVS4TInCorpMB FOREIGN KEY 
(
TICMTCmpCode
) REFERENCES VS4TCompany (
TCmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInCorpMB ALTER COLUMN TICMTIncCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInCorpMB ADD 
CONSTRAINT VS4TInCorpVS4TInCorpMB FOREIGN KEY 
(
TICMTIncCode
) REFERENCES VS4TInCorp (
TIncCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInquiry ALTER COLUMN TIQRTIQGCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TInquiry ADD 
CONSTRAINT VS4TInquiryGroupVS4TInquiry FOREIGN KEY 
(
TIQRTIQGCode
) REFERENCES VS4TInquiryGroup (
TIQGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInquiryChoice ALTER COLUMN TIQCTIQRCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TInquiryChoice ADD 
CONSTRAINT VS4TInquiryVS4TInquiryChoice FOREIGN KEY 
(
TIQCTIQRCode
) REFERENCES VS4TInquiry (
TIQRCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInsurance ALTER COLUMN TIslTIsTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInsurance ADD 
CONSTRAINT VS4TInsuranceTypeVS4TInsurance FOREIGN KEY 
(
TIslTIsTCode
) REFERENCES VS4TInsuranceType (
TIsTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAdjust ALTER COLUMN TIjtTIBkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAdjust ADD 
CONSTRAINT VS4TInventBookVS4TInventAdjust FOREIGN KEY 
(
TIjtTIBkCode
) REFERENCES VS4TInventBook (
TIBkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAdjust ALTER COLUMN TIjtTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAdjust ADD 
CONSTRAINT VS4TProjectVS4TInventAdjust FOREIGN KEY 
(
TIjtTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAdjustMB ALTER COLUMN TIjMTIjtNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAdjustMB ADD 
CONSTRAINT VS4TInventAdjustVS4TInventAdjustMB FOREIGN KEY 
(
TIjMTIjtNo
) REFERENCES VS4TInventAdjust (
TIjtNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAdjustMB ALTER COLUMN TIjMTLctCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAdjustMB ADD 
CONSTRAINT VS4TLocationVS4TInventAdjustMB FOREIGN KEY 
(
TIjMTLctCode
) REFERENCES VS4TLocation (
TLctCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAdjustMB ALTER COLUMN TIjMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAdjustMB ADD 
CONSTRAINT VS4TProductVS4TInventAdjustMB FOREIGN KEY 
(
TIjMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAPCN ALTER COLUMN TIPITInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAPCN ALTER COLUMN TIPITInMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventAPCN ADD 
CONSTRAINT VS4TInventoryMBVS4TInventAPCN FOREIGN KEY 
(
TIPITInMTInvNo,TIPITInMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventAPIV ALTER COLUMN TIPVTIoMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventAPIV ALTER COLUMN TIPVTIoMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventAPIV ADD 
CONSTRAINT VS4TInventoryMBVS4TInventAPIV FOREIGN KEY 
(
TIPVTIoMTInvNo,TIPVTIoMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventARCN ALTER COLUMN TIRCTInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventARCN ALTER COLUMN TIRCTInMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventARCN ADD 
CONSTRAINT VS4TInventoryMBVS4TInventARCN FOREIGN KEY 
(
TIRCTInMTInvNo,TIRCTInMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventARIV ALTER COLUMN TIRVTInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventARIV ALTER COLUMN TIRVTInMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventARIV ADD 
CONSTRAINT VS4TInventoryMBVS4TInventARIV FOREIGN KEY 
(
TIRVTInMTInvNo,TIRVTInMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventMDS ALTER COLUMN TIDSTInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventMDS ALTER COLUMN TIDSTInMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventMDS ADD 
CONSTRAINT VS4TInventoryMBVS4TInventMDS FOREIGN KEY 
(
TIDSTInMTInvNo,TIDSTInMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventory ALTER COLUMN TInvTIBkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventory ADD 
CONSTRAINT VS4TInventBookVS4TInventory FOREIGN KEY 
(
TInvTIBkCode
) REFERENCES VS4TInventBook (
TIBkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventory ALTER COLUMN TInvTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventory ADD 
CONSTRAINT VS4TProjectVS4TInventory FOREIGN KEY 
(
TInvTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventory ALTER COLUMN TInvTInTAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventory ADD 
CONSTRAINT VS4TStkMoveTypeVS4TStkMove FOREIGN KEY 
(
TInvTInTAlias
) REFERENCES VS4TInventoryType (
TInTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventory2 ALTER COLUMN TIn2TInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventory2 ADD 
CONSTRAINT VS4TInventoryVS4TInventory2 FOREIGN KEY 
(
TIn2TInvNo
) REFERENCES VS4TInventory (
TInvNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryCost ALTER COLUMN TIM2TPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryCost ALTER COLUMN TIM2Custom1 NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryCost ALTER COLUMN TIM2SerialNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryCost ALTER COLUMN TIM2LotNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryCost ALTER COLUMN TIM2LotDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TInventoryCost ADD 
CONSTRAINT VS4TInventoryCostVS4TInventoryCost2 FOREIGN KEY 
(
TIM2TPdtCode,TIM2Custom1,TIM2SerialNo,TIM2LotNo,TIM2LotDate
) REFERENCES VS4TInventoryLOT (
TIMCTPdtCodeTIMCCustom1TIMCSerialNoTIMCLotNoTIMCLotDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryInit ALTER COLUMN TInITInGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryInit ADD 
CONSTRAINT VS4TInventoryInitGVS4TInventoryInit FOREIGN KEY 
(
TInITInGAlias
) REFERENCES VS4TInventoryInitG (
TInGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryInit ALTER COLUMN TInITLctCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryInit ADD 
CONSTRAINT VS4TLocationVS4TInventoryInit FOREIGN KEY 
(
TInITLctCode
) REFERENCES VS4TLocation (
TLctCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryLOT ALTER COLUMN TIMCTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryLOT ADD 
CONSTRAINT VS4TProductVS4TInventoryCost FOREIGN KEY 
(
TIMCTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMCustom1 NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMSerialNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMLotNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMLotDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ADD 
CONSTRAINT VS4TInventoryCostVS4TInventoryMB FOREIGN KEY 
(
TInMTPdtCode,TInMCustom1,TInMSerialNo,TInMLotNo,TInMLotDate
) REFERENCES VS4TInventoryLOT (
TIMCTPdtCodeTIMCCustom1TIMCSerialNoTIMCLotNoTIMCLotDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMTInTAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ADD 
CONSTRAINT VS4TInventoryTypeVS4TInventoryMB FOREIGN KEY 
(
TInMTInTAlias
) REFERENCES VS4TInventoryType (
TInTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ADD 
CONSTRAINT VS4TInventoryVS4TInventoryMB FOREIGN KEY 
(
TInMTInvNo
) REFERENCES VS4TInventory (
TInvNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMTLctCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ADD 
CONSTRAINT VS4TLocationVS4TInventoryMB FOREIGN KEY 
(
TInMTLctCode
) REFERENCES VS4TLocation (
TLctCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventoryMB ALTER COLUMN TInMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventoryMB ADD 
CONSTRAINT VS4TProductVS4TInventoryMB FOREIGN KEY 
(
TInMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventPDE ALTER COLUMN TIDPTInMTInvNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventPDE ALTER COLUMN TIDPTInMLn INT NOT NULL 
GO

ALTER TABLE VS4TInventPDE ADD 
CONSTRAINT VS4TInventoryMBVS4TInventPDE FOREIGN KEY 
(
TIDPTInMTInvNo,TIDPTInMLn
) REFERENCES VS4TInventoryMB (
TInMTInvNoTInMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventPDE ALTER COLUMN TIDPTPDETPOBTPODNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventPDE ALTER COLUMN TIDPTPDETPOBLn INT NOT NULL 
GO

ALTER TABLE VS4TInventPDE ALTER COLUMN TIDPTPDELn INT NOT NULL 
GO

ALTER TABLE VS4TInventPDE ADD 
CONSTRAINT VS4TPODeliveryVS4TInventPDE FOREIGN KEY 
(
TIDPTPDETPOBTPODNo,TIDPTPDETPOBLn,TIDPTPDELn
) REFERENCES VS4TPODelivery (
TPDETPOBTPODNoTPDETPOBLnTPDELn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRCustom1 NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRSerialNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRLotNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRLotDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TInventSerial ADD 
CONSTRAINT VS4TInventoryCostVS4TInventSerial FOREIGN KEY 
(
TInRTPdtCode,TInRCustom1,TInRSerialNo,TInRLotNo,TInRLotDate
) REFERENCES VS4TInventoryLOT (
TIMCTPdtCodeTIMCCustom1TIMCSerialNoTIMCLotNoTIMCLotDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRTLctCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ADD 
CONSTRAINT VS4TLocationVS4TInventSerial FOREIGN KEY 
(
TInRTLctCode
) REFERENCES VS4TLocation (
TLctCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TInventSerial ALTER COLUMN TInRTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TInventSerial ADD 
CONSTRAINT VS4TProductVS4TInventSerial FOREIGN KEY 
(
TInRTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TISO ALTER COLUMN TISOTISGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TISO ADD 
CONSTRAINT VS4TISOGroupVS4TISO FOREIGN KEY 
(
TISOTISGCode
) REFERENCES VS4TISOGroup (
TISGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJob ALTER COLUMN TJobTJBkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJob ADD 
CONSTRAINT VS4TJobBookVS4TJob FOREIGN KEY 
(
TJobTJBkCode
) REFERENCES VS4TJobBook (
TJBkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJob ALTER COLUMN TJobTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJob ADD 
CONSTRAINT VS4TProjectVS4TJob FOREIGN KEY 
(
TJobTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobDL ALTER COLUMN TJDLTJbMTJobNo NVARCHAR (50) NOT NULL 
GO

ALTER TABLE VS4TJobDL ALTER COLUMN TJDLTJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobDL ADD 
CONSTRAINT VS4TJobMBVS4TJobDL FOREIGN KEY 
(
TJDLTJbMTJobNo,TJDLTJbMLn
) REFERENCES VS4TJobMB (
TJbMTJobNoTJbMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMaterial ALTER COLUMN TJMtTJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMaterial ALTER COLUMN TJMtTJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobMaterial ADD 
CONSTRAINT VS4TJobMBVS4TJobMaterial FOREIGN KEY 
(
TJMtTJbMTJobNo,TJMtTJbMLn
) REFERENCES VS4TJobMB (
TJbMTJobNoTJbMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobMB ADD 
CONSTRAINT VS4TJobCostSheetVS4TJobMB FOREIGN KEY 
(
TJbMTJobNo,TJbMLn
) REFERENCES VS4TJobCostSheet (
TJCSID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobMB ADD 
CONSTRAINT VS4TJobProductionVS4TJobMB FOREIGN KEY 
(
TJbMTJobNo,TJbMLn
) REFERENCES VS4TJobProduction (
TJPdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMB ADD 
CONSTRAINT VS4TJobVS4TJobMB FOREIGN KEY 
(
TJbMTJobNo
) REFERENCES VS4TJob (
TJobNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMB ADD 
CONSTRAINT VS4TJobVS4TJobMB1 FOREIGN KEY 
(
TJbMTJobNo
) REFERENCES VS4TJob (
TJobNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMB ALTER COLUMN TJbMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMB ADD 
CONSTRAINT VS4TProductVS4TJobMB FOREIGN KEY 
(
TJbMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMBSerial ALTER COLUMN TJMSTJbMTJobNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMBSerial ALTER COLUMN TJMSTJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobMBSerial ADD 
CONSTRAINT VS4TJobMBVS4TJobMBSerial FOREIGN KEY 
(
TJMSTJbMTJobNo,TJMSTJbMLn
) REFERENCES VS4TJobMB (
TJbMTJobNoTJbMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMethod ALTER COLUMN TJStTJbMTJobNo NVARCHAR (50) NOT NULL 
GO

ALTER TABLE VS4TJobMethod ALTER COLUMN TJStTJbMLn INT NOT NULL 
GO

ALTER TABLE VS4TJobMethod ADD 
CONSTRAINT VS4TJobMBVS4TJobMethod FOREIGN KEY 
(
TJStTJbMTJobNo,TJStTJbMLn
) REFERENCES VS4TJobMB (
TJbMTJobNoTJbMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobMethod ALTER COLUMN TJStTSepCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobMethod ADD 
CONSTRAINT VS4TMRPStepNameVS4TJobMethod FOREIGN KEY 
(
TJStTSepCode
) REFERENCES VS4TMRPStepName (
TSepCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProdDL ALTER COLUMN TJPLTJPdNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProdDL ADD 
CONSTRAINT VS4TJobProductionVS4TJobProdDL FOREIGN KEY 
(
TJPLTJPdNo
) REFERENCES VS4TJobProduction (
TJPdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProdExpMB ALTER COLUMN TJebTJpeNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProdExpMB ADD 
CONSTRAINT VS4TJobProdExpDocVS4TJobProdExpMB FOREIGN KEY 
(
TJebTJpeNo
) REFERENCES VS4TJobProdExpDoc (
TJpeNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProdMat ALTER COLUMN TMteTJPdNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProdMat ADD 
CONSTRAINT VS4TJobProductionVS4TJobProdMat FOREIGN KEY 
(
TMteTJPdNo
) REFERENCES VS4TJobProduction (
TJPdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProduction ALTER COLUMN TJPdTJPkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProduction ADD 
CONSTRAINT VS4TJobProdBookVS4TJobProduction FOREIGN KEY 
(
TJPdTJPkCode
) REFERENCES VS4TJobProdBook (
TJPkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProduction ALTER COLUMN TJPdTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProduction ADD 
CONSTRAINT VS4TProjectVS4TJobProduction FOREIGN KEY 
(
TJPdTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProductionM ALTER COLUMN TJPMTJPdNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProductionM ADD 
CONSTRAINT VS4TJobProductionVS4TJobProductionM FOREIGN KEY 
(
TJPMTJPdNo
) REFERENCES VS4TJobProduction (
TJPdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TJobProductionM ALTER COLUMN TJPMTSepCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TJobProductionM ADD 
CONSTRAINT VS4TMRPStepNameVS4TJobProductionM FOREIGN KEY 
(
TJPMTSepCode
) REFERENCES VS4TMRPStepName (
TSepCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TKBase ALTER COLUMN TKBsTKBGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TKBase ADD 
CONSTRAINT VS4TKBaseGroupVS4TKBase FOREIGN KEY 
(
TKBsTKBGCode
) REFERENCES VS4TKBaseGroup (
TKBGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TLocation ALTER COLUMN TLctTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TLocation ADD 
CONSTRAINT VS4TBranchVS4TLocation FOREIGN KEY 
(
TLctTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TLocation ALTER COLUMN TLctTWahCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TLocation ADD 
CONSTRAINT VS4TWarehouseVS4TLocation FOREIGN KEY 
(
TLctTWahCode
) REFERENCES VS4TWarehouse (
TWahCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TLocationMap ALTER COLUMN TLcMTRomCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TLocationMap ADD 
CONSTRAINT VS4TLocationRoomVS4TLocationMap FOREIGN KEY 
(
TLcMTRomCode
) REFERENCES VS4TLocationRoom (
TRomCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TLocationRoom ALTER COLUMN TRomTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TLocationRoom ADD 
CONSTRAINT VS4TBranchVS4TLocationRoom FOREIGN KEY 
(
TRomTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TLocationRoom ALTER COLUMN TRomTWahCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TLocationRoom ADD 
CONSTRAINT VS4TWarehouseVS4TLocationRoom FOREIGN KEY 
(
TRomTWahCode
) REFERENCES VS4TWarehouse (
TWahCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMDSMB ALTER COLUMN TMDMTMDNNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMDSMB ADD 
CONSTRAINT VS4TMDSVS4TMDSMB FOREIGN KEY 
(
TMDMTMDNNo
) REFERENCES VS4TMDS (
TMDNNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMemberGroupMB ALTER COLUMN TMMBTMbGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMemberGroupMB ADD 
CONSTRAINT VS4TMemberGroupVS4TMemberGroupMB FOREIGN KEY 
(
TMMBTMbGCode
) REFERENCES VS4TMemberGroup (
TMbGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMemberGroupMB ALTER COLUMN TMMBTMbrCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMemberGroupMB ADD 
CONSTRAINT VS4TMemberVS4TMemberGroupMB FOREIGN KEY 
(
TMMBTMbrCode
) REFERENCES VS4TMember (
TMbrCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMoldSetMB ALTER COLUMN TMSMTMoSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMoldSetMB ADD 
CONSTRAINT VS4TMoldSetVS4TMoldSetMB FOREIGN KEY 
(
TMSMTMoSCode
) REFERENCES VS4TMoldSet (
TMoSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMoldSetMB ALTER COLUMN TMSMTMolCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMoldSetMB ADD 
CONSTRAINT VS4TMoldVS4TMoldSetMB FOREIGN KEY 
(
TMSMTMolCode
) REFERENCES VS4TMold (
TMolCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMPR ALTER COLUMN TMPRTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMPR ADD 
CONSTRAINT VS4TBranchVS4TMPR FOREIGN KEY 
(
TMPRTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMPR ALTER COLUMN TMPRTDivCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMPR ADD 
CONSTRAINT VS4TDivisionVS4TMPR FOREIGN KEY 
(
TMPRTDivCode
) REFERENCES VS4TDivision (
TDivCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMPRMB ALTER COLUMN TMPMTMPRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMPRMB ADD 
CONSTRAINT VS4TMPRVS4TMPRMB FOREIGN KEY 
(
TMPMTMPRNo
) REFERENCES VS4TMPR (
TMPRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMPRMB ALTER COLUMN TMPMTPstCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMPRMB ADD 
CONSTRAINT VS4TPositionVS4TMPRMB FOREIGN KEY 
(
TMPMTPstCode
) REFERENCES VS4TPosition (
TPstCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMRPFormula ALTER COLUMN TMRFTAgtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMRPFormula ADD 
CONSTRAINT VS4TAssetWorkGroupVS4TMRPFormula FOREIGN KEY 
(
TMRFTAgtCode
) REFERENCES VS4TAssetWorkGroup (
TAgtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMRPFormula ALTER COLUMN TMRFTMRGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMRPFormula ADD 
CONSTRAINT VS4TMRPFormulaGroupVS4TMRPFormula FOREIGN KEY 
(
TMRFTMRGCode
) REFERENCES VS4TMRPFormulaGrp (
TMRGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TMRPStepName ALTER COLUMN TSepTSecCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TMRPStepName ADD 
CONSTRAINT VS4TSectionVS4TMRPStepName FOREIGN KEY 
(
TSepTSecCode
) REFERENCES VS4TSection (
TSecCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPackingListMB ALTER COLUMN TPKMTPKLNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPackingListMB ADD 
CONSTRAINT VS4TPackingListVS4TPackingListMB FOREIGN KEY 
(
TPKMTPKLNo
) REFERENCES VS4TPackingList (
TPKLNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPAMB ALTER COLUMN TPAMTPADNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPAMB ADD 
CONSTRAINT VS4TPAVS4TPAMB FOREIGN KEY 
(
TPAMTPADNo
) REFERENCES VS4TPA (
TPADNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPAMB ALTER COLUMN TPAMTPSDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPAMB ADD 
CONSTRAINT VS4TPSVS4TPAMB FOREIGN KEY 
(
TPAMTPSDNo
) REFERENCES VS4TPS (
TPSDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TParameter ALTER COLUMN TParTCmGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TParameter ADD 
CONSTRAINT VS4TCommandGroupVS4TParameter FOREIGN KEY 
(
TParTCmGAlias
) REFERENCES VS4TCommandGroup (
TCmGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPayment ALTER COLUMN TPymTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TPayment ADD 
CONSTRAINT VS4TCurrencyVS4TPayment FOREIGN KEY 
(
TPymTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPayment ALTER COLUMN TPymTPyTAlias NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPayment ADD 
CONSTRAINT VS4TPaymentTypeVS4TPayment FOREIGN KEY 
(
TPymTPyTAlias
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPCR ALTER COLUMN TPCRTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPCR ADD 
CONSTRAINT VS4TAPVS4TPCR FOREIGN KEY 
(
TPCRTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPCR ALTER COLUMN TPCRTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPCR ADD 
CONSTRAINT VS4TProjectVS4TPCR FOREIGN KEY 
(
TPCRTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPCRMB ALTER COLUMN TPMBTPCRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPCRMB ADD 
CONSTRAINT VS4TPCRVS4TPCRMB FOREIGN KEY 
(
TPMBTPCRNo
) REFERENCES VS4TPCR (
TPCRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPCRMB ALTER COLUMN TPMBTPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPCRMB ADD 
CONSTRAINT VS4TPOSVS4TPCRMB FOREIGN KEY 
(
TPMBTPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPO ALTER COLUMN TPODTPCACode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPO ADD 
CONSTRAINT VS4TAPCampaignVS4TPO FOREIGN KEY 
(
TPODTPCACode
) REFERENCES VS4TAPCampaign (
TPCACode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPO ALTER COLUMN TPODTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPO ADD 
CONSTRAINT VS4TAPVS4TPO FOREIGN KEY 
(
TPODTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPO ALTER COLUMN TPODTPOkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPO ADD 
CONSTRAINT VS4TPOBookVS4TPO FOREIGN KEY 
(
TPODTPOkCode
) REFERENCES VS4TPOBook (
TPOKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPO ALTER COLUMN TPODTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPO ADD 
CONSTRAINT VS4TProjectVS4TPO FOREIGN KEY 
(
TPODTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPODelivery ALTER COLUMN TPDETPOBTPODNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPODelivery ALTER COLUMN TPDETPOBLn INT NOT NULL 
GO

ALTER TABLE VS4TPODelivery ADD 
CONSTRAINT VS4TPOMBVS4TPODelivery FOREIGN KEY 
(
TPDETPOBTPODNo,TPDETPOBLn
) REFERENCES VS4TPOMB (
TPOBLnTPOBTPODNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOMB ALTER COLUMN TPOBTPODNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOMB ADD 
CONSTRAINT VS4TPWOVS4TPWOMB FOREIGN KEY 
(
TPOBTPODNo
) REFERENCES VS4TPO (
TPODNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPayPeriod ALTER COLUMN TPPPTPyTAlias NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPOPayPeriod ADD 
CONSTRAINT VS4TPaymentTypeVS4TPOPayPeriod FOREIGN KEY 
(
TPPPTPyTAlias
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPayPeriod ALTER COLUMN TPPPTPPTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPayPeriod ADD 
CONSTRAINT VS4TPayPeriodTypeVS4TPOPayPeriod FOREIGN KEY 
(
TPPPTPPTCode
) REFERENCES VS4TPayPeriodType (
TPPTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPayPeriod ALTER COLUMN TPPPTPODNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPayPeriod ADD 
CONSTRAINT VS4TPOVS4TPOPayPeriod FOREIGN KEY 
(
TPPPTPODNo
) REFERENCES VS4TPO (
TPODNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPSaleOut ALTER COLUMN TPPSTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPSaleOut ADD 
CONSTRAINT VS4TARVS4TPOPSaleOut FOREIGN KEY 
(
TPPSTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPSaleOut ALTER COLUMN TPPSTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPSaleOut ADD 
CONSTRAINT VS4TBranchVS4TPOPSaleOut FOREIGN KEY 
(
TPPSTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPTrans ALTER COLUMN TPPDTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPTrans ADD 
CONSTRAINT VS4TBranchVS4TPOPTrans FOREIGN KEY 
(
TPPDTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPTrans ALTER COLUMN TPPDTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPTrans ADD 
CONSTRAINT VS4TProjectVS4TPOPTrans FOREIGN KEY 
(
TPPDTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPTransMB ALTER COLUMN TPTBTPPDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPTransMB ADD 
CONSTRAINT VS4TPOPTransVS4TPOPTransMB FOREIGN KEY 
(
TPTBTPPDNo
) REFERENCES VS4TPOPTrans (
TPPDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPTransMB ALTER COLUMN TPTBTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOPTransMB ADD 
CONSTRAINT VS4TProductVS4TPOPTransMB FOREIGN KEY 
(
TPTBTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOPTransMB ALTER COLUMN TPTBTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPOPTransMB ADD 
CONSTRAINT VS4TUnitVS4TPOPTransMB FOREIGN KEY 
(
TPTBTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSMB ALTER COLUMN TPoMTPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSMB ADD 
CONSTRAINT VS4TPOSVS4TPOSMB FOREIGN KEY 
(
TPoMTPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSMB ALTER COLUMN TPoMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSMB ADD 
CONSTRAINT VS4TProductVS4TPOSMB FOREIGN KEY 
(
TPoMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTrans ALTER COLUMN TPTATPBKCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTrans ADD 
CONSTRAINT VS4TPOSBookVS4TPOSTrans FOREIGN KEY 
(
TPTATPBKCode
) REFERENCES VS4TPOSBook (
TPBKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTrans ALTER COLUMN TPTATPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTrans ADD 
CONSTRAINT VS4TProjectVS4TPOSTrans FOREIGN KEY 
(
TPTATPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransEmp ALTER COLUMN TPTETPTANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransEmp ADD 
CONSTRAINT VS4TPOSTransVS4TPOSTransEmp FOREIGN KEY 
(
TPTETPTANo
) REFERENCES VS4TPOSTrans (
TPTANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransfer ALTER COLUMN TPTRTPBKCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransfer ADD 
CONSTRAINT VS4TPOSBookVS4TPOSTransfer FOREIGN KEY 
(
TPTRTPBKCode
) REFERENCES VS4TPOSBook (
TPBKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransferMB ALTER COLUMN TPTMTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransferMB ADD 
CONSTRAINT VS4TARVS4TPOSTransferMB FOREIGN KEY 
(
TPTMTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransferMB ALTER COLUMN TPTMTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransferMB ADD 
CONSTRAINT VS4TCompanyBankVS4TPOSTransferMB FOREIGN KEY 
(
TPTMTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransferMB ALTER COLUMN TPTMPaymentType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPOSTransferMB ADD 
CONSTRAINT VS4TPaymentTypeVS4TPOSTransferMB FOREIGN KEY 
(
TPTMPaymentType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransferMB ALTER COLUMN TPTMTPTRNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransferMB ADD 
CONSTRAINT VS4TPOSTransferVS4TPOSTransferMB FOREIGN KEY 
(
TPTMTPTRNo
) REFERENCES VS4TPOSTransfer (
TPTRNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransGuide ALTER COLUMN TPTGTPTANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransGuide ADD 
CONSTRAINT VS4TPOSTransVS4TPOSTransGuide FOREIGN KEY 
(
TPTGTPTANo
) REFERENCES VS4TPOSTrans (
TPTANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransPay ALTER COLUMN TPPyPaymentType NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPOSTransPay ADD 
CONSTRAINT VS4TPaymentTypeVS4TPOSTransPay FOREIGN KEY 
(
TPPyPaymentType
) REFERENCES VS4TPaymentType (
TPyTAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransPay ALTER COLUMN TPPyTPTANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransPay ADD 
CONSTRAINT VS4TPOSTransVS4TPOSPayment FOREIGN KEY 
(
TPPyTPTANo
) REFERENCES VS4TPOSTrans (
TPTANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransSub ALTER COLUMN TPTSTPTANo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransSub ADD 
CONSTRAINT VS4TPOSTransVS4TPOSTransSub FOREIGN KEY 
(
TPTSTPTANo
) REFERENCES VS4TPOSTrans (
TPTANo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPOSTransSub ALTER COLUMN TPTSTPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPOSTransSub ADD 
CONSTRAINT VS4TPOSVS4TPOSTransSub FOREIGN KEY 
(
TPTSTPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPQMB ALTER COLUMN TPQMTPQDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPQMB ADD 
CONSTRAINT VS4TPQVS4TPQMB FOREIGN KEY 
(
TPQMTPQDNo
) REFERENCES VS4TPQ (
TPQDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPR ALTER COLUMN TPRDTPRBCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPR ADD 
CONSTRAINT VS4TPRBookVS4TPR FOREIGN KEY 
(
TPRDTPRBCode
) REFERENCES VS4TPRBook (
TPRBCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPR ALTER COLUMN TPRDTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPR ADD 
CONSTRAINT VS4TProjectVS4TPR FOREIGN KEY 
(
TPRDTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPricelistMB ALTER COLUMN TPPMTPPLNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPricelistMB ADD 
CONSTRAINT VS4TPOSPriceVS4TPOSPriceMB FOREIGN KEY 
(
TPPMTPPLNo
) REFERENCES VS4TPricelist (
TPPLNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPricelistMB ALTER COLUMN TPPMTPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPricelistMB ADD 
CONSTRAINT VS4TPOSVS4TPOSPrice FOREIGN KEY 
(
TPPMTPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPricelistMB ALTER COLUMN TPPMTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPricelistMB ADD 
CONSTRAINT VS4TUnitVS4TPricelistMB FOREIGN KEY 
(
TPPMTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPRMB ALTER COLUMN TPRMTPRDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPRMB ADD 
CONSTRAINT VS4TPWRVS4TPWRMB FOREIGN KEY 
(
TPRMTPRDNo
) REFERENCES VS4TPR (
TPRDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProduct ALTER COLUMN TPdtTPDLCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProduct ADD 
CONSTRAINT VS4TProductLineVS4TProduct FOREIGN KEY 
(
TPdtTPDLCode
) REFERENCES VS4TProductLine (
TPdLCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProduct ALTER COLUMN TPdtTPSECode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProduct ADD 
CONSTRAINT VS4TProductSectionVS4TProduct FOREIGN KEY 
(
TPdtTPSECode
) REFERENCES VS4TProductSection (
TPSECode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProduct ALTER COLUMN TPdtTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TProduct ADD 
CONSTRAINT VS4TUnitVS4TProduct FOREIGN KEY 
(
TPdtTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProduct2 ALTER COLUMN TPd2TPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProduct2 ADD 
CONSTRAINT VS4TProductVS4TProduct2 FOREIGN KEY 
(
TPd2TPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductAsset ALTER COLUMN TPM2TAssCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductAsset ADD 
CONSTRAINT VS4TAssetVS4TPOSAssetMB FOREIGN KEY 
(
TPM2TAssCode
) REFERENCES VS4TAsset (
TAssCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductAsset ALTER COLUMN TPM2TPOSCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductAsset ADD 
CONSTRAINT VS4TPOSVS4TPOSMB2 FOREIGN KEY 
(
TPM2TPOSCode
) REFERENCES VS4TPOS (
TPOSCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductDL ALTER COLUMN TPLBTPdtCode NVARCHAR (50) NOT NULL 
GO

ALTER TABLE VS4TProductDL ADD 
CONSTRAINT VS4TProductVS4TProductDL FOREIGN KEY 
(
TPLBTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductImage ALTER COLUMN TPImTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductImage ADD 
CONSTRAINT VS4TProductVS4TProductImage FOREIGN KEY 
(
TPImTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductLeadTim ALTER COLUMN TPLtTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductLeadTim ADD 
CONSTRAINT VS4TProductVS4TProductLeadTim FOREIGN KEY 
(
TPLtTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductLineMB ALTER COLUMN TPLMTPDLCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductLineMB ADD 
CONSTRAINT VS4TProductLineVS4TProductLineMB FOREIGN KEY 
(
TPLMTPDLCode
) REFERENCES VS4TProductLine (
TPdLCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductLineMB ALTER COLUMN TPLMTPSECode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductLineMB ADD 
CONSTRAINT VS4TProductSectionVS4TProductLineMB FOREIGN KEY 
(
TPLMTPSECode
) REFERENCES VS4TProductSection (
TPSECode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductMat ALTER COLUMN TPMtTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductMat ADD 
CONSTRAINT VS4TProductVS4TProductMat1 FOREIGN KEY 
(
TPMtTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductMB ALTER COLUMN TPDMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductMB ADD 
CONSTRAINT VS4TProductVS4TProductMat FOREIGN KEY 
(
TPDMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductMethod ALTER COLUMN TSpdTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductMethod ADD 
CONSTRAINT VS4TProductVS4TProductMethod FOREIGN KEY 
(
TSpdTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductMethod ALTER COLUMN TSpdTSepCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductMethod ADD 
CONSTRAINT VS4TStepNameVS4TFormulaProduct FOREIGN KEY 
(
TSpdTSepCode
) REFERENCES VS4TMRPStepName (
TSepCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductOH ALTER COLUMN TPOHTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductOH ADD 
CONSTRAINT VS4TProductVS4TProductOH FOREIGN KEY 
(
TPOHTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductRelate ALTER COLUMN TPdRTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductRelate ADD 
CONSTRAINT VS4TProductVS4TProductRelate FOREIGN KEY 
(
TPdRTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductSafeS ALTER COLUMN TPSSTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductSafeS ADD 
CONSTRAINT VS4TProductVS4TProductSafeS FOREIGN KEY 
(
TPSSTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductSec2 ALTER COLUMN TPS2TPdLCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductSec2 ADD 
CONSTRAINT VS4TProductLineVS4TProductSec2 FOREIGN KEY 
(
TPS2TPdLCode
) REFERENCES VS4TProductLine (
TPdLCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductSec3 ALTER COLUMN TPS3TPdLCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductSec3 ADD 
CONSTRAINT VS4TProductLineVS4TProductSec3 FOREIGN KEY 
(
TPS3TPdLCode
) REFERENCES VS4TProductLine (
TPdLCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductSec4 ALTER COLUMN TPS4TPdLCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductSec4 ADD 
CONSTRAINT VS4TProductLineVS4TProductSec4 FOREIGN KEY 
(
TPS4TPdLCode
) REFERENCES VS4TProductLine (
TPdLCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductStat ALTER COLUMN TPMSTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductStat ADD 
CONSTRAINT VS4TProductVS4TProductStat FOREIGN KEY 
(
TPMSTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductSub ALTER COLUMN TPdSTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductSub ADD 
CONSTRAINT VS4TProductVS4TProductSub2 FOREIGN KEY 
(
TPdSTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProductUnit ALTER COLUMN TPDUTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProductUnit ADD 
CONSTRAINT VS4TProductVS4TProductUnit FOREIGN KEY 
(
TPDUTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProject ALTER COLUMN TPrjTPjTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProject ADD 
CONSTRAINT VS4TProjectTypeVS4TProject FOREIGN KEY 
(
TPrjTPjTCode
) REFERENCES VS4TProjectType (
TPjTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProjectBOQ ALTER COLUMN TP2QTBOQNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProjectBOQ ADD 
CONSTRAINT VS4TBOQVS4TProjectBOQ FOREIGN KEY 
(
TP2QTBOQNo
) REFERENCES VS4TBOQ (
TBOQNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProjectBOQ ALTER COLUMN TP2QTPHSTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProjectBOQ ALTER COLUMN TP2QTPHSLn INT NOT NULL 
GO

ALTER TABLE VS4TProjectBOQ ADD 
CONSTRAINT VS4TProjectPhaseVS4TProjectBOQ FOREIGN KEY 
(
TP2QTPHSTPrjCode,TP2QTPHSLn
) REFERENCES VS4TProjectPhase (
TPHSTPrjCodeTPHSLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProjectPhase ALTER COLUMN TPHSTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TProjectPhase ADD 
CONSTRAINT VS4TProjectVS4TProjectPhase FOREIGN KEY 
(
TPHSTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPromotionMB ALTER COLUMN TPMMTProNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPromotionMB ADD 
CONSTRAINT VS4TPromotionVS4TPromotionMB FOREIGN KEY 
(
TPMMTProNo
) REFERENCES VS4TPromotion (
TProNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TProvince ALTER COLUMN TPrvTCouCode NVARCHAR (3) NOT NULL 
GO

ALTER TABLE VS4TProvince ADD 
CONSTRAINT VS4TCountryVS4TProvince FOREIGN KEY 
(
TPrvTCouCode
) REFERENCES VS4TCountry (
TCouCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPS ALTER COLUMN TPSDTPCACode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPS ADD 
CONSTRAINT VS4TAPCampaignVS4TPS FOREIGN KEY 
(
TPSDTPCACode
) REFERENCES VS4TAPCampaign (
TPCACode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPS ALTER COLUMN TPSDTAPNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPS ADD 
CONSTRAINT VS4TAPVS4TPS FOREIGN KEY 
(
TPSDTAPNCode
) REFERENCES VS4TAP (
TAPNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPS ALTER COLUMN TPSDTPOKCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPS ADD 
CONSTRAINT VS4TPOBookVS4TPS FOREIGN KEY 
(
TPSDTPOKCode
) REFERENCES VS4TPOBook (
TPOKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPS ALTER COLUMN TPSDTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPS ADD 
CONSTRAINT VS4TProjectVS4TPS FOREIGN KEY 
(
TPSDTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPSMB ALTER COLUMN TPSMTPSDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPSMB ADD 
CONSTRAINT VS4TPWSVS4TPWSMB FOREIGN KEY 
(
TPSMTPSDNo
) REFERENCES VS4TPS (
TPSDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPurPriceListMB ALTER COLUMN TPUMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPurPriceListMB ADD 
CONSTRAINT VS4TProductVS4TPurPriceListMB FOREIGN KEY 
(
TPUMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPurPriceListMB ALTER COLUMN TPUMTPUPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TPurPriceListMB ADD 
CONSTRAINT VS4TPurPriceListVS4TPurPriceListMB FOREIGN KEY 
(
TPUMTPUPNo
) REFERENCES VS4TPurPriceList (
TPUPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TPurPriceListMB ALTER COLUMN TPUMTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TPurPriceListMB ADD 
CONSTRAINT VS4TUnitVS4TPurPriceListMB FOREIGN KEY 
(
TPUMTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuickProduct ALTER COLUMN TQpdTPPuCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuickProduct ADD 
CONSTRAINT VS4TProductPURTypeVS4TQuickProduct FOREIGN KEY 
(
TQpdTPPuCode
) REFERENCES VS4TProductPURType (
TPPuCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuickProduct ALTER COLUMN TQpdTPS1Code NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuickProduct ADD 
CONSTRAINT VS4TProductSectionVS4TQuickProduct FOREIGN KEY 
(
TQpdTPS1Code
) REFERENCES VS4TProductSection (
TPSECode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuickProduct ALTER COLUMN TQpdTPTTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuickProduct ADD 
CONSTRAINT VS4TProductTypeVS4TQuickProduct FOREIGN KEY 
(
TQpdTPTTCode
) REFERENCES VS4TProductType (
TPTTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuickProductMB ALTER COLUMN TQPMTQPdNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuickProductMB ADD 
CONSTRAINT VS4TQuickProductVS4TQuickProductMB FOREIGN KEY 
(
TQPMTQPdNo
) REFERENCES VS4TQuickProduct (
TQPdNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotation ALTER COLUMN TQuoTRCACode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotation ADD 
CONSTRAINT VS4TARCampaignVS4TQuotation FOREIGN KEY 
(
TQuoTRCACode
) REFERENCES VS4TARCampaign (
TRCACode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotation ALTER COLUMN TQuoTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotation ADD 
CONSTRAINT VS4TARVS4TQuotation FOREIGN KEY 
(
TQuoTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotation ALTER COLUMN TQuoTDStCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotation ADD 
CONSTRAINT VS4TDocumentStatusVS4TQuotation FOREIGN KEY 
(
TQuoTDStCode
) REFERENCES VS4TDocumentStatus (
TDStCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotation ALTER COLUMN TQuoTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotation ADD 
CONSTRAINT VS4TProjectVS4TQuotation FOREIGN KEY 
(
TQuoTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotation ALTER COLUMN TQuoTSBkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotation ADD 
CONSTRAINT VS4TSOBookVS4TQuotation FOREIGN KEY 
(
TQuoTSBkCode
) REFERENCES VS4TSOBook (
TSBKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotationMB ALTER COLUMN TQuBTQuoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotationMB ADD 
CONSTRAINT VS4TQuotationVS4TQuotationMB FOREIGN KEY 
(
TQuBTQuoNo
) REFERENCES VS4TQuotation (
TQuoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotationSetMB ALTER COLUMN TQSBTQuSNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotationSetMB ADD 
CONSTRAINT VS4TQuotationSetVS4TQuotationSetMB FOREIGN KEY 
(
TQSBTQuSNo
) REFERENCES VS4TQuotationSet (
TQuSNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotationSetMB ALTER COLUMN TQSBTQuoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotationSetMB ADD 
CONSTRAINT VS4TQuotationVS4TQuotationSetMB FOREIGN KEY 
(
TQSBTQuoNo
) REFERENCES VS4TQuotation (
TQuoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TQuotationSetMB ALTER COLUMN TQSBTQuoNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TQuotationSetMB ADD 
CONSTRAINT VS4TQuotationVS4TQuotationSetMB1 FOREIGN KEY 
(
TQSBTQuoNo
) REFERENCES VS4TQuotation (
TQuoNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TReceivePduMB ALTER COLUMN TRPMTRCPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TReceivePduMB ADD 
CONSTRAINT VS4TReceivePduVS4TReceivePduMB FOREIGN KEY 
(
TRPMTRCPNo
) REFERENCES VS4TReceivePdu (
TRCPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TReviseEffect ALTER COLUMN TReETRevDocType NVARCHAR (10) NOT NULL 
GO

ALTER TABLE VS4TReviseEffect ALTER COLUMN TReETRevDocNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TReviseEffect ALTER COLUMN TReETRevNo SMALLINT NOT NULL 
GO

ALTER TABLE VS4TReviseEffect ADD 
CONSTRAINT VS4TRevisionVS4TReviseEffect FOREIGN KEY 
(
TReETRevDocType,TReETRevDocNo,TReETRevNo
) REFERENCES VS4TRevision (
TRevDocTypeTRevDocNoTRevNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TRevision ALTER COLUMN TRevTReGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TRevision ADD 
CONSTRAINT VS4TRevisionGroupVS4TRevision FOREIGN KEY 
(
TRevTReGCode
) REFERENCES VS4TRevisionGroup (
TReGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleArea ALTER COLUMN TSaeTSZnCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleArea ADD 
CONSTRAINT VS4TSaleZoneVS4TSaleArea FOREIGN KEY 
(
TSaeTSZnCode
) REFERENCES VS4TSaleZone (
TSZnCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleForecastDL ALTER COLUMN TSFDTSFCTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastDL ALTER COLUMN TSFDTSFCYear INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastDL ALTER COLUMN TSFDTSFCMonth INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastDL ALTER COLUMN TSFDTSFCTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastDL ALTER COLUMN TSFDTSFCTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastDL ADD 
CONSTRAINT VS4TSaleForecastVS4TSaleForecastDL FOREIGN KEY 
(
TSFDTSFCTBraCode,TSFDTSFCYear,TSFDTSFCMonth,TSFDTSFCTPdtCode,TSFDTSFCTEmpCode
) REFERENCES VS4TSaleForecast (
TSFCTBraCodeTSFCYearTSFCMonthTSFCTPdtCodeTSFCTEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleForecastMB ALTER COLUMN TSFBTSFCTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMB ALTER COLUMN TSFBTSFCYear INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMB ALTER COLUMN TSFBTSFCMonth INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMB ALTER COLUMN TSFBTSFCTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMB ALTER COLUMN TSFBTSFCTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMB ADD 
CONSTRAINT VS4TSaleForecastVS4TSaleForecastMB FOREIGN KEY 
(
TSFBTSFCTBraCode,TSFBTSFCYear,TSFBTSFCMonth,TSFBTSFCTPdtCode,TSFBTSFCTEmpCode
) REFERENCES VS4TSaleForecast (
TSFCTBraCodeTSFCYearTSFCMonthTSFCTPdtCodeTSFCTEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleForecastMT ALTER COLUMN TSFMTSFCTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMT ALTER COLUMN TSFMTSFCYear INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMT ALTER COLUMN TSFMTSFCMonth INT NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMT ALTER COLUMN TSFMTSFCTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMT ALTER COLUMN TSFMTSFCTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleForecastMT ADD 
CONSTRAINT VS4TSaleForecastVS4TSaleForecastMT FOREIGN KEY 
(
TSFMTSFCTBraCode,TSFMTSFCYear,TSFMTSFCMonth,TSFMTSFCTPdtCode,TSFMTSFCTEmpCode
) REFERENCES VS4TSaleForecast (
TSFCTBraCodeTSFCYearTSFCMonthTSFCTPdtCodeTSFCTEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleTarget ALTER COLUMN TSTGTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleTarget ADD 
CONSTRAINT VS4TBranchVS4TSaleTarget FOREIGN KEY 
(
TSTGTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSaleTargetMB ALTER COLUMN TSGMTSTGNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSaleTargetMB ADD 
CONSTRAINT VS4TSaleTargetVS4TSaleTargetMB FOREIGN KEY 
(
TSGMTSTGNo
) REFERENCES VS4TSaleTarget (
TSTGNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSAR ALTER COLUMN TSARTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSAR ADD 
CONSTRAINT VS4TBranchVS4TSAR FOREIGN KEY 
(
TSARTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSAR ALTER COLUMN TSARTSRPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSAR ADD 
CONSTRAINT VS4TSARPatternVS4TSAR FOREIGN KEY 
(
TSARTSRPNo
) REFERENCES VS4TSARPattern (
TSRPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSARMB ALTER COLUMN TSRBTSRMTSRGTSRPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSARMB ALTER COLUMN TSRB2TSRMTSRGLn INT NOT NULL 
GO

ALTER TABLE VS4TSARMB ALTER COLUMN TSRBTSRMLn INT NOT NULL 
GO

ALTER TABLE VS4TSARMB ADD 
CONSTRAINT VS4TSARPatternMBVS4TSARMB FOREIGN KEY 
(
TSRBTSRMTSRGTSRPNo,TSRB2TSRMTSRGLn,TSRBTSRMLn
) REFERENCES VS4TSARPatternMB (
TSRMTSRGTSRPNoTSRMTSRGLnTSRMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSARMB ALTER COLUMN TSRBTSARNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSARMB ADD 
CONSTRAINT VS4TSARVS4TSARMB FOREIGN KEY 
(
TSRBTSARNo
) REFERENCES VS4TSAR (
TSARNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSARPatGroup ALTER COLUMN TSRGTSRPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSARPatGroup ADD 
CONSTRAINT VS4TSARPatternVS4TSARPatGroup FOREIGN KEY 
(
TSRGTSRPNo
) REFERENCES VS4TSARPattern (
TSRPNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSARPatternMB ALTER COLUMN TSRMTSRGTSRPNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSARPatternMB ALTER COLUMN TSRMTSRGLn INT NOT NULL 
GO

ALTER TABLE VS4TSARPatternMB ADD 
CONSTRAINT VS4TSARPatGroupVS4TSARPatternMB FOREIGN KEY 
(
TSRMTSRGTSRPNo,TSRMTSRGLn
) REFERENCES VS4TSARPatGroup (
TSRGTSRPNoTSRGLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSection ALTER COLUMN TSecTDepCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSection ADD 
CONSTRAINT VS4TDepartmentVS4TSection FOREIGN KEY 
(
TSecTDepCode
) REFERENCES VS4TDepartment (
TDepCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSO ALTER COLUMN TSODTRCACode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSO ADD 
CONSTRAINT VS4TARCampaignVS4TSO FOREIGN KEY 
(
TSODTRCACode
) REFERENCES VS4TARCampaign (
TRCACode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSO ALTER COLUMN TSODTARNCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSO ADD 
CONSTRAINT VS4TARVS4TSO FOREIGN KEY 
(
TSODTARNCode
) REFERENCES VS4TAR (
TARNCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSO ALTER COLUMN TSODTPrjCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSO ADD 
CONSTRAINT VS4TProjectVS4TSO FOREIGN KEY 
(
TSODTPrjCode
) REFERENCES VS4TProject (
TPrjCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSO ALTER COLUMN TSODTSBkCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSO ADD 
CONSTRAINT VS4TSOBookVS4TSO FOREIGN KEY 
(
TSODTSBkCode
) REFERENCES VS4TSOBook (
TSBKCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSOMB ALTER COLUMN TSOBTSODNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSOMB ADD 
CONSTRAINT VS4TSOVS4TSOMB FOREIGN KEY 
(
TSOBTSODNo
) REFERENCES VS4TSO (
TSODNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSOPassenger ALTER COLUMN TVSPTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSOPassenger ADD 
CONSTRAINT VS4TProductVS4TSOPassenger FOREIGN KEY 
(
TVSPTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TStockNow ALTER COLUMN TSFNTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TStockNow ALTER COLUMN TSFNCustom1 NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TStockNow ALTER COLUMN TSFNSerialNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TStockNow ALTER COLUMN TSFNLotNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TStockNow ALTER COLUMN TSFNLotDate DATETIME NOT NULL 
GO

ALTER TABLE VS4TStockNow ADD 
CONSTRAINT VS4TInventoryCostVS4TStockNow FOREIGN KEY 
(
TSFNTPdtCode,TSFNCustom1,TSFNSerialNo,TSFNLotNo,TSFNLotDate
) REFERENCES VS4TInventoryLOT (
TIMCTPdtCodeTIMCCustom1TIMCSerialNoTIMCLotNoTIMCLotDate
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSwitchTimeGpMB ALTER COLUMN TSWMTEmGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSwitchTimeGpMB ADD 
CONSTRAINT VS4TEmployeeGroupVS4TSwitchTimeGpMB FOREIGN KEY 
(
TSWMTEmGCode
) REFERENCES VS4TEmployeeGroup (
TEmGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSwitchTimeGpMB ALTER COLUMN TSWMTSWGNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSwitchTimeGpMB ADD 
CONSTRAINT VS4TSwitchTimeGpVS4TSwitchTimeGpMB FOREIGN KEY 
(
TSWMTSWGNo
) REFERENCES VS4TSwitchTimeGp (
TSwGNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSwitchTimeMB ALTER COLUMN TSTMTEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSwitchTimeMB ADD 
CONSTRAINT VS4TEmployeeVS4TSwitchTimeMB FOREIGN KEY 
(
TSTMTEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSwitchTimeMB ALTER COLUMN TSTMTSWTNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSwitchTimeMB ADD 
CONSTRAINT VS4TSwitchTimeVS4TSwitchTimeMB FOREIGN KEY 
(
TSTMTSWTNo
) REFERENCES VS4TSwitchTime (
TSwTNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSystem ALTER COLUMN TSysTSyGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSystem ADD 
CONSTRAINT VS4TSystemGroupVS4TSystem FOREIGN KEY 
(
TSysTSyGAlias
) REFERENCES VS4TSystemGroup (
TSyGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TSystemBranch ALTER COLUMN TSyBTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TSystemBranch ADD 
CONSTRAINT VS4TBranchVS4TSystemBranch FOREIGN KEY 
(
TSyBTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTaxRate ALTER COLUMN TTxRTTaxAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTaxRate ADD 
CONSTRAINT VS4TTaxVS4TTaxRate FOREIGN KEY 
(
TTxRTTaxAlias
) REFERENCES VS4TTax (
TTaxAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTeasuryTransMB ALTER COLUMN TTTMToTCBBNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTeasuryTransMB ADD 
CONSTRAINT VS4TCompanyBankVS4TTeasuryTransMB FOREIGN KEY 
(
TTTMToTCBBNo
) REFERENCES VS4TCompanyBank (
TCBBNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTeasuryTransMB ALTER COLUMN TTTMTCurCode NVARCHAR (5) NOT NULL 
GO

ALTER TABLE VS4TTeasuryTransMB ADD 
CONSTRAINT VS4TCurrencyVS4TTeasuryTransMB FOREIGN KEY 
(
TTTMTCurCode
) REFERENCES VS4TCurrency (
TCurCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTeasuryTransMB ALTER COLUMN TTTMTTeTNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTeasuryTransMB ADD 
CONSTRAINT VS4TTeasuryTransVS4TTeasuryTransMB FOREIGN KEY 
(
TTTMTTeTNo
) REFERENCES VS4TTeasuryTrans (
TTeTNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTimeInputNote ALTER COLUMN TTINTTIPID INT NOT NULL 
GO

ALTER TABLE VS4TTimeInputNote ADD 
CONSTRAINT VS4TTimeInputVS4TTimeInputNote FOREIGN KEY 
(
TTINTTIPID
) REFERENCES VS4TTimeInput (
TTIPID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTmpSelectSetMB ALTER COLUMN TTSMTSSID INT NOT NULL 
GO

ALTER TABLE VS4TTmpSelectSetMB ADD 
CONSTRAINT VS4TTmpSelectSetVS4TTmpSelectSetMB FOREIGN KEY 
(
TTSMTSSID
) REFERENCES VS4TTmpSelectSet (
TTSSID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTR ALTER COLUMN TTRDTIBKCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTR ADD 
CONSTRAINT VS4TInventBookVS4TTR FOREIGN KEY 
(
TTRDTIBKCode
) REFERENCES VS4TInventBook (
TIBkCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTrainingCourse ALTER COLUMN TTrCTTrGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTrainingCourse ADD 
CONSTRAINT VS4TTrainingGroupVS4TTrainingCourse FOREIGN KEY 
(
TTrCTTrGCode
) REFERENCES VS4TTrainingGroup (
TTrGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTRMB ALTER COLUMN TTRMTPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTRMB ADD 
CONSTRAINT VS4TProductVS4TTRMB FOREIGN KEY 
(
TTRMTPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTRMB ALTER COLUMN TTRMTTRDNo NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TTRMB ADD 
CONSTRAINT VS4TTRVS4TTRMB FOREIGN KEY 
(
TTRMTTRDNo
) REFERENCES VS4TTR (
TTRDNo
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TTRMB ALTER COLUMN TTRMTUntCode NVARCHAR (15) NOT NULL 
GO

ALTER TABLE VS4TTRMB ADD 
CONSTRAINT VS4TUnitVS4TTRMB FOREIGN KEY 
(
TTRMTUntCode
) REFERENCES VS4TUnit (
TUntCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUnit ALTER COLUMN TUntTUnGAlias NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TUnit ADD 
CONSTRAINT VS4TUnitGroupVS4TUnit FOREIGN KEY 
(
TUntTUnGAlias
) REFERENCES VS4TUnitGroup (
TUnGAlias
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserAlert ALTER COLUMN TUsATCmdID INT NOT NULL 
GO

ALTER TABLE VS4TUserAlert ADD 
CONSTRAINT VS4TCommandVS4TUserAlert FOREIGN KEY 
(
TUsATCmdID
) REFERENCES VS4TCommand (
TCmdID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserAlert ALTER COLUMN TUsATUsrID INT NOT NULL 
GO

ALTER TABLE VS4TUserAlert ADD 
CONSTRAINT VS4TUserVS4TUserAlert FOREIGN KEY 
(
TUsATUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserBranch ALTER COLUMN TUsBTBraCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TUserBranch ADD 
CONSTRAINT VS4TBranchVS4TUserBranch FOREIGN KEY 
(
TUsBTBraCode
) REFERENCES VS4TBranch (
TBraCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserBranch ALTER COLUMN TUsBTUsrID INT NOT NULL 
GO

ALTER TABLE VS4TUserBranch ADD 
CONSTRAINT VS4TUserVS4TUserBranch FOREIGN KEY 
(
TUsBTUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserEmployee ALTER COLUMN TUsETEmpCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TUserEmployee ADD 
CONSTRAINT VS4TEmployeeVS4TUserEmployee FOREIGN KEY 
(
TUsETEmpCode
) REFERENCES VS4TEmployee (
TEmpCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserEmployee ALTER COLUMN TUsETUsrID INT NOT NULL 
GO

ALTER TABLE VS4TUserEmployee ADD 
CONSTRAINT VS4TUserVS4TUserEmployee FOREIGN KEY 
(
TUsETUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TUserPermiss ALTER COLUMN TUsPTUsrID INT NOT NULL 
GO

ALTER TABLE VS4TUserPermiss ADD 
CONSTRAINT VS4TUserVS4TUserPermiss FOREIGN KEY 
(
TUsPTUsrID
) REFERENCES VS4TUser (
TUsrID
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TVehicle ALTER COLUMN TVehTVeTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TVehicle ADD 
CONSTRAINT VS4TVehicleTypeVS4TVehicle FOREIGN KEY 
(
TVehTVeTCode
) REFERENCES VS4TVehicleType (
TVeTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TVehicleRate ALTER COLUMN TVeRTVeTCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TVehicleRate ADD 
CONSTRAINT VS4TVehicleTypeVS4TVehicleRate FOREIGN KEY 
(
TVeRTVeTCode
) REFERENCES VS4TVehicleType (
TVeTCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TVisa ALTER COLUMN TVSATPdtCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TVisa ADD 
CONSTRAINT VS4TProductVS4TVisa FOREIGN KEY 
(
TVSATPdtCode
) REFERENCES VS4TProduct (
TPdtCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TWelfare ALTER COLUMN TWelTAmyCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TWelfare ADD 
CONSTRAINT VS4TEmpAddMoneyVS4TWelfare FOREIGN KEY 
(
TWelTAmyCode
) REFERENCES VS4TEmpAddMoney (
TAmyCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TWelfare ALTER COLUMN TWelTWfGCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TWelfare ADD 
CONSTRAINT VS4TWelfareGroupVS4TWelfare FOREIGN KEY 
(
TWelTWfGCode
) REFERENCES VS4TWelfareGroup (
TWfGCode
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TWorkflow ALTER COLUMN TWFWCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TWorkflow ADD 
CONSTRAINT VS4TWorkflowMBVS4TWorkflow FOREIGN KEY 
(
TWFWCode
) REFERENCES VS4TWorkflowMB (
TWFMTWFWCodeTWFMLn
) ON UPDATE CASCADE
GO

ALTER TABLE VS4TWorkflowData ALTER COLUMN TWFDTWFMTWFWCode NVARCHAR (30) NOT NULL 
GO

ALTER TABLE VS4TWorkflowData ALTER COLUMN TWFDTWFMLn INT NOT NULL 
GO

ALTER TABLE VS4TWorkflowData ADD 
CONSTRAINT VS4TWorkflowMBVS4TWorkflowData FOREIGN KEY 
(
TWFDTWFMTWFWCode,TWFDTWFMLn
) REFERENCES VS4TWorkflowMB (
TWFMTWFWCodeTWFMLn
) ON UPDATE CASCADE
GO

