Editing a Schema.ini File

A schema.ini file defines the columns for a text file, overwriting all other settings.

The OLE-DB driver for a text file looks for a schema.ini file in the same directory as the text file to be imported. This can define all aspects of the processing of the text file:
  • Column names
  • Data types for all columns
  • The character set
  • Data conversions.

The easiest way to work with a schema.ini file is to use the Microsoft Windows facilities to create it, and then edit the file to suit your requirements.

To edit a schema.ini file:

  1. Depending on your machine architecture:
    • On a 32-bit operating system, open the Control Panel and start ODBC.
    • On a 64-bit operating system, open a Command Window and run:
    The ODBC Data Source Administrator dialog appears.

  2. Click Add....
    The Create New Data Source dialog appears.

  3. Select Microsoft Text Driver (*.txt; *.csv), and click Finish.
    The ODBC Text Setup dialog appears.

  4. Click on the Select Directory... button, and select the directory where the text file is stored.
  5. Still in the ODBC Text Setup dialog, click Define Format....
    The Define Text Format dialog appears.

  6. If your text file has a column headers in the first line/row, click Guess, and the column names appear in the Columns list.
    If required, you can modify column names and formats can be performed in this dialog. Select a column name from the list, and edit the attributes below.
  7. When satisfied with your column details, click OK in the Define Text Format dialog.
  8. In the last dialog, click Cancel to avoid setting up a new data source.
  9. In Windows Explorer, check the directory where the text file resides, and you will find a new schema.ini file there.
  10. Edit and modify the schema.ini file using a flat text editor such as Notepad or WordPad.
For more information about configuring a schema.ini file, see http://msdn.microsoft.com/en-us/library/ms709353(VS.85).aspx

2022 R1