Log In    |    Knowledge Base    |    4D Home
Tech Tip: Matching your 4D field types to your ODBC data source's tables
PRODUCT: 4D | VERSION: 2004.2 | PLATFORM: Mac & Win
Published On: September 15, 2006

"Was my ODBC table's 'StartDate' the field type Date or Varchar?"

When you have tens or hundreds of fields in your SQL Server / MySQL table, figuring out the correct field types and generating field mappings for export can be difficult and time consuming. It doesn't help that the errors reported by the system ODBC drivers during trial exports with 4D can be difficult to interpret either.

An easy way to figure out field types for 4D from a ODBC data source is to have 4D do it for you. What you can do is create a new database and use 4D's User Mode Import feature to automatically generate a table with fields where all ODBC fields are mapped to 4D fields using the ODBC source's chosen field order.

1) Start a new blank database
2) Go to User Mode
3) File -> Import -> From ODBC Source
4) select your ODBC Source
5) In the Import interface, first select the ODBC table in the dropdown on the right
6) Check "Create Table"
7) Import
8) Review the table created for field types and order.

Using the order that the ODBC source provided will immensely simply future User Mode Exports to the ODBC Source, since 4D will auto-map the fields based on field creation order.