Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why does this generate an invalid dbc?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Why does this generate an invalid dbc?
Miscellaneous
Thread ID:
00192535
Message ID:
00192535
Views:
69
The program below tries to create a dbc, but after issuing the command:
alter table 'System_Data' add foreign key tag 'cSdAdKey' references 'Address'
the dbc becomes invalid. see BOOM below
When is the next "service pack" comming out?
Carl

Incase this dosn't cut and paste well, the prg can be found at http://www.personnelware.com/samples/pwdbc.prg
modify database pw nowait
create table PwCod name 'Code_Definition'  ( cCDKey c (6) not null primary key )
open database pw validate
create table PwMcd name 'Clasification'  ( cMCKey c (6) not null primary key )
alter table 'PwMcd'  add cMCCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwTxp name 'Tax_Paramtter'   ( cTPKey c (6) not null primary key )
alter table 'PwTxp'  add cTPStt c (1)
alter table 'PwTxp'  add cTPCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwAdr name 'Address'  ( cADKey c (6) not null primary key )
alter table 'PwAdr'  add cADStt c (1)
alter table 'PwAdr'  add cADCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwSd name 'System_Data'    ( cSDKey c (6) not null primary key )
open database pw validate
create table PwWcr name 'Workers_Comp_Rate'      ( cWCKey c (6) not null primary key )
alter table 'PwWcr'  add cWCID c (10) not null unique
alter table 'PwWcr'   add cWCNam c (20)  
alter table 'PwWcr'  add cWCStt c (1) 
open database pw validate
create table PwCln name 'Client'  ( cCLKey c (6) not null primary key )
alter table 'PwCln'  add cCLID c (10) not null unique
alter table 'PwCln'   add cCLNam c (20) 
alter table 'PwCln'  add cCLStt c (1)
alter table 'PwCln'  add cCLMCKey c (6) references 'Clasification'
open database pw validate
create table PwCwl name 'Work_Location'   ( cWLKey c (6) not null primary key )
alter table 'PwCwl'  add cWLStt c (1)
open database pw validate
create table PwCon name 'Contact'  ( cCNKey c (6) not null primary key )
alter table 'PwCon'   add cCNNam c (20) 
alter table 'PwCon'  add cCNStt c (1)
alter table 'PwCon'  add cCNMCKey c (6) references 'Clasification'
open database pw validate
create table PwPrj name 'Project'  ( cPJKey c (6) not null primary key )
alter table 'PwPrj'  add cPJID c (10) not null unique
alter table 'PwPrj'   add cPJNam c (20) 
alter table 'PwPrj'  add cPJStt c (1)
alter table 'PwPrj'  add cPJMCKey c (6) references 'Clasification'
open database pw validate
create table PwJbo name 'Job_Order'  ( cJOKey c (6) not null primary key )
alter table 'PwJbo'  add cJOID c (10) not null unique
alter table 'PwJbo'  add cJOStt c (1)
alter table 'PwJbo'  add cJOMCKey c (6) references 'Clasification'
open database pw validate
create table PwPrs name 'Person'  ( cPEKey c (6) not null primary key )
alter table 'PwPrs'  add cPEID c (10) not null unique
alter table 'PwPrs'   add cPENam c (20) 
alter table 'PwPrs'  add cPEStt c (1)
alter table 'PwPrs'  add cPEMCKey c (6) references 'Clasification'
open database pw validate
create table PwPed name 'Document'    ( cPDKey c (6) not null primary key )
alter table 'PwPed'  add cPDStt c (1)
open database pw validate
create table PwAsg name 'Assignment'   ( cASKey c (6) not null primary key )
alter table 'PwAsg'  add cASStt c (1)
open database pw validate
create table PwSkc name 'Skill_Code'  ( cSCKey c (6) not null primary key )
open database pw validate
create table PwApt name 'Appointment'   ( cATKey c (6) not null primary key )
open database pw validate
create table PwWhp name 'Withholding_Parameter'    ( cWPKey c (6) not null primary key )
alter table 'PwWhp'   add cWPNam c (20)  
alter table 'PwWhp'  add cWPStt c (1) 
open database pw validate
create table PwDdp name 'Deduction_Definition_Parameter'   ( cDPKey c (6) not null primary key )
alter table 'PwDdp'  add cDPCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwIda name 'Individual_Deduction_Assignment'  ( cDAKey c (6) not null primary key )
alter table 'PwIda'  add cDACdKey c (6) references 'Code_Definition'
open database pw validate
create table PwDap name 'Deduction_Assignment_Parameter'     ( cAPKey c (6) not null primary key )
alter table 'PwDap'  add cAPCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwInv name 'Invoice'  ( cIVKey c (6) not null primary key )
alter table 'PwInv'  add cIVID c (10) not null unique
alter table 'PwInv'  add cIVStt c (1)
open database pw validate
create table PwBil name 'Bill_Item'  ( cBIKey c (6) not null primary key )
alter table 'PwBil'  add cBIID c (10) not null unique
alter table 'PwBil'  add cBIStt c (1)
alter table 'PwBil'  add cBIMCKey c (6) references 'Clasification'
open database pw validate
create table PwIvd name 'Invoice_Detail'  ( cIDKey c (6) not null primary key )
alter table 'PwIvd'  add cIDCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwIdm name 'Invoice_Mods'   ( cIMKey c (6) not null primary key )
alter table 'PwIdm'  add cIMCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwPck name 'Pay_Check'    ( cPkKey c (6) not null primary key )
alter table 'PwPck'  add cPkID c (10) not null unique
alter table 'PwPck'  add cPkStt c (1)
open database pw validate
create table PwPay name 'Pay_Item'   ( cYIKey c (6) not null primary key )
alter table 'PwPay'  add cYIMCKey c (6) references 'Clasification'
open database pw validate
create table PwPrd name 'PayRolI_detail'  ( cPRKey c (6) not null primary key )
alter table 'PwPrd'  add cPRCdKey c (6) references 'Code_Definition'
open database pw validate
create table PwAcr name 'AR_Check'    ( cACKey c (6) not null primary key )
alter table 'PwAcr'  add cACID c (10) not null unique
open database pw validate
create table PwTrn name 'Transaction'  ( cTRKey c (6) not null primary key )
alter table 'PwTrn'  add cTRID c (10) not null unique
alter table 'PwTrn'  add cTRStt c (1)
open database pw validate
create table PwElg name 'Error_Log'  ( cELKey c (6) not null primary key )
alter table 'PwElg'  add cELID c (10) not null unique
open database pw validate
alter table 'System_Data' add cSdAdKey c (6) 
open database pw validate
alter table 'System_Data' add foreign key tag 'cSdAdKey' references 'Address'

open database pw validate
* BOOM!

alter table 'System_Data' alter 'cSdAdKey'
open database pw validate
alter table 'Work_Location' add cWlAdKey c (6) 
open database pw validate
alter table 'Work_Location' add foreign key tag 'cWlAdKey' references 'Address'
open database pw validate
alter table 'Work_Location' alter 'cWlAdKey'
open database pw validate
alter table 'Work_Location' add cWlClKey c (6) 
open database pw validate
alter table 'Work_Location' add foreign key tag 'cWlClKey' references 'Client'
open database pw validate
alter table 'Work_Location' alter 'cWlClKey'
open database pw validate
alter table 'Contact' add cCnAdKey c (6) 
open database pw validate
alter table 'Contact' add foreign key tag 'cCnAdKey' references 'Address'
open database pw validate
alter table 'Contact' alter 'cCnAdKey'
alter table 'Contact' alter 'cCnAdKey' null
open database pw validate
alter table 'Contact' add cCnClKey c (6) 
open database pw validate
alter table 'Contact' add foreign key tag 'cCnClKey' references 'Client'
open database pw validate
alter table 'Contact' alter 'cCnClKey'
open database pw validate
alter table 'Project' add cPjClKey c (6) 
open database pw validate
alter table 'Project' add foreign key tag 'cPjClKey' references 'Client'
open database pw validate
alter table 'Project' alter 'cPjClKey'
open database pw validate
alter table 'Job_Order' add cJoWcKey c (6) 
open database pw validate
alter table 'Job_Order' add foreign key tag 'cJoWcKey' references 'Workers_Comp_Rate'
open database pw validate
alter table 'Job_Order' alter 'cJoWcKey'
open database pw validate
alter table 'Job_Order' add cJoPjKey c (6) 
open database pw validate
alter table 'Job_Order' add foreign key tag 'cJoPjKey' references 'Project'
open database pw validate
alter table 'Job_Order' alter 'cJoPjKey'
open database pw validate
alter table 'Job_Order' add cJoWlKey c (6) 
open database pw validate
alter table 'Job_Order' add foreign key tag 'cJoWlKey' references 'Work_Location'
open database pw validate
alter table 'Job_Order' alter 'cJoWlKey'
open database pw validate
alter table 'Person' add cPeAdKey c (6) 
open database pw validate
alter table 'Person' add foreign key tag 'cPeAdKey' references 'Address'
open database pw validate
alter table 'Person' alter 'cPeAdKey'
alter table 'Person' alter 'cPeAdKey' null
open database pw validate
alter table 'Document' add cPdPeKey c (6) 
open database pw validate
alter table 'Document' add foreign key tag 'cPdPeKey' references 'Person'
open database pw validate
alter table 'Document' alter 'cPdPeKey'
open database pw validate
alter table 'Assignment' add cAsPeKey c (6) 
open database pw validate
alter table 'Assignment' add foreign key tag 'cAsPeKey' references 'Person'
open database pw validate
alter table 'Assignment' alter 'cAsPeKey'
open database pw validate
alter table 'Assignment' add cAsJoKey c (6) 
open database pw validate
alter table 'Assignment' add foreign key tag 'cAsJoKey' references 'Job_Order'
open database pw validate
alter table 'Assignment' alter 'cAsJoKey'
open database pw validate
alter table 'Skill_Code' add cScPeKey c (6) 
open database pw validate
alter table 'Skill_Code' add foreign key tag 'cScPeKey' references 'Person'
open database pw validate
alter table 'Skill_Code' alter 'cScPeKey'
open database pw validate
alter table 'Appointment' add cAtPeKey c (6) 
open database pw validate
alter table 'Appointment' add foreign key tag 'cAtPeKey' references 'Person'
open database pw validate
alter table 'Appointment' alter 'cAtPeKey'
open database pw validate
alter table 'Withholding_Parameter' add cWpPeKey c (6) 
open database pw validate
alter table 'Withholding_Parameter' add foreign key tag 'cWpPeKey' references 'Person'
open database pw validate
alter table 'Withholding_Parameter' alter 'cWpPeKey'
open database pw validate
alter table 'Individual_Deduction_Assignment' add cDaPeKey c (6) 
open database pw validate
alter table 'Individual_Deduction_Assignment' add foreign key tag 'cDaPeKey' references 'Person'
open database pw validate
alter table 'Individual_Deduction_Assignment' alter 'cDaPeKey'
open database pw validate
alter table 'Deduction_Assignment_Parameter' add cApDaKey c (6)  
open database pw validate
alter table 'Deduction_Assignment_Parameter' add foreign key tag 'cApDaKey' references 'Individual_Deduction_Assignment'
open database pw validate
alter table 'Deduction_Assignment_Parameter' alter 'cApDaKey'
open database pw validate
alter table 'Bill_Item' add cBiIvKey c (6) 
open database pw validate
alter table 'Bill_Item' add foreign key tag 'cBiIvKey' references 'Invoice'
open database pw validate
alter table 'Bill_Item' alter 'cBiIvKey'
open database pw validate
alter table 'Bill_Item' add cBiAsKey c (6) 
open database pw validate
alter table 'Bill_Item' add foreign key tag 'cBiAsKey' references 'Assignment'
open database pw validate
alter table 'Bill_Item' alter 'cBiAsKey'
alter table 'Bill_Item' alter 'cBiAsKey' null
open database pw validate
alter table 'Bill_Item' add cBiWlKey c (6) 
open database pw validate
alter table 'Bill_Item' add foreign key tag 'cBiWlKey' references 'Work_Location'
open database pw validate
alter table 'Bill_Item' alter 'cBiWlKey'
open database pw validate
alter table 'Invoice_Detail' add cIdBiKey c (6) 
open database pw validate
alter table 'Invoice_Detail' add foreign key tag 'cIdBiKey' references 'Bill_Item'
open database pw validate
alter table 'Invoice_Detail' alter 'cIdBiKey'
open database pw validate
alter table 'Invoice_Mods' add cImBiKey c (6) 
open database pw validate
alter table 'Invoice_Mods' add foreign key tag 'cImBiKey' references 'Bill_Item'
open database pw validate
alter table 'Invoice_Mods' alter 'cImBiKey'
open database pw validate
alter table 'Pay_Item' add cYiAsKey c (6) 
open database pw validate
alter table 'Pay_Item' add foreign key tag 'cYiAsKey' references 'Assignment'
open database pw validate
alter table 'Pay_Item' alter 'cYiAsKey'
alter table 'Pay_Item' alter 'cYiAsKey' null
open database pw validate
alter table 'Pay_Item' add cYiPkKey c (6) 
open database pw validate
alter table 'Pay_Item' add foreign key tag 'cYiPkKey' references 'Pay_Check'
open database pw validate
alter table 'Pay_Item' alter 'cYiPkKey'
open database pw validate
alter table 'Pay_Item' add cYiWcKey c (6) 
open database pw validate
alter table 'Pay_Item' add foreign key tag 'cYiWcKey' references 'Workers_Comp_Rate'
open database pw validate
alter table 'Pay_Item' alter 'cYiWcKey'
alter table 'Pay_Item' alter 'cYiWcKey' null
open database pw validate
alter table 'Pay_Item' add cYiPeKey c (6) 
open database pw validate
alter table 'Pay_Item' add foreign key tag 'cYiPeKey' references 'Person'
open database pw validate
alter table 'Pay_Item' alter 'cYiPeKey'
open database pw validate
alter table 'PayRolI_detail' add cPrYiKey c (6) 
open database pw validate
alter table 'PayRolI_detail' add foreign key tag 'cPrYiKey' references 'Pay_Item'
open database pw validate
alter table 'PayRolI_detail' alter 'cPrYiKey'
open database pw validate
alter table 'AR_Check' add cAcClKey c (6) 
open database pw validate
alter table 'AR_Check' add foreign key tag 'cAcClKey' references 'Client'
open database pw validate
alter table 'AR_Check' alter 'cAcClKey'
open database pw validate
alter table 'Transaction' add cTrClKey c (6) 
open database pw validate
alter table 'Transaction' add foreign key tag 'cTrClKey' references 'Client'
open database pw validate
alter table 'Transaction' alter 'cTrClKey'
open database pw validate
alter table 'Transaction' add cTrBiKey c (6) 
open database pw validate
alter table 'Transaction' add foreign key tag 'cTrBiKey' references 'Bill_Item'
open database pw validate
alter table 'Transaction' alter 'cTrBiKey'
alter table 'Transaction' alter 'cTrBiKey' null
open database pw validate
alter table 'Transaction' add cTrAcKey c (6) 
open database pw validate
alter table 'Transaction' add foreign key tag 'cTrAcKey' references 'AR_Check'
open database pw validate
alter table 'Transaction' alter 'cTrAcKey'
alter table 'Transaction' alter 'cTrAcKey' null
open database pw validate
Next
Reply
Map
View

Click here to load this message in the networking platform