tranchemontaigne
Registered User.
- Local time
- Today, 05:19
- Joined
- Aug 12, 2008
- Messages
- 203
BACKGROUND
I'm in the process of migrating a flat database application to a relational system. As part of this effort I need to build scripts to create a new relational data model and migrate data.
ENVIRONMENT
MS Access 2000
APPROACH
I'm using DDL to define new table structures, migrate data, and drop legacy tables.
PROBLEM
Some fields need table validation. I'm attempting to use the DDL CHECK keyword to implement this validation. Here's a sample DDL script used to create tables. I am experiencing syntax errors associated with the CHECK clause on t10_Refugee_ID.
<quote>
CREATE TABLE t10_Person
(
t10_Person_ID counter PRIMARY KEY,
t10_Record_Num long ,
t10_First_Report_Date date ,
t10_First_Name text(50) ,
t10_Last_Name text(50) ,
t10_Sex text(1) ,
t10_DOB date ,
t10_Age byte ,
t10_Birth_Country_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Year_Arrived_In_US int ,
t10_Race_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Ethnicity_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Refugee_ID byte CHECK (t10_Refugee_ID in(1,2,9) ),
t10_Immigrant_ID byte
)
</quote>
Any assistance if fixing CHECK syntax would be appreciated.
I'm in the process of migrating a flat database application to a relational system. As part of this effort I need to build scripts to create a new relational data model and migrate data.
ENVIRONMENT
MS Access 2000
APPROACH
I'm using DDL to define new table structures, migrate data, and drop legacy tables.
PROBLEM
Some fields need table validation. I'm attempting to use the DDL CHECK keyword to implement this validation. Here's a sample DDL script used to create tables. I am experiencing syntax errors associated with the CHECK clause on t10_Refugee_ID.
<quote>
CREATE TABLE t10_Person
(
t10_Person_ID counter PRIMARY KEY,
t10_Record_Num long ,
t10_First_Report_Date date ,
t10_First_Name text(50) ,
t10_Last_Name text(50) ,
t10_Sex text(1) ,
t10_DOB date ,
t10_Age byte ,
t10_Birth_Country_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Year_Arrived_In_US int ,
t10_Race_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Ethnicity_ID long REFERENCES t02_Codes (t02_Codes_ID),
t10_Refugee_ID byte CHECK (t10_Refugee_ID in(1,2,9) ),
t10_Immigrant_ID byte
)
</quote>
Any assistance if fixing CHECK syntax would be appreciated.
Last edited: