A schema file can be used with a text file data source to define column names and types.
To configure schema file settings:
1. | Open the schema configuration window by selecting the Create Schema File button on the text file data source window. |
2. | If the text file contains column headers in the first line of the file check the has column headers checkbox. |
3. | Select the required file format. |
4. | Select the character set (standard is OEM) |
5. | The columns will then be displayed in the grid below. |
6. | If column names are not in the data, or changes to column names are required the column names may be changed in the grid. |
7. | If an incorrect data type or size is showing for a column, select the correct data type or enter the correct size. |
8. | Select OK to close the window. Whenever data is retrieved from the data source the schema file will be removed from the source directory and re-created with the entered settings. |
Notes:
• | When using the text file data source, all data loads are made via the ODBC text driver. The driver will make a best guess attempt at reading the text file, however if the ODBC driver returns invalid columns or data a schema.ini file should be created and placed in the directory from which the text file will be loaded. |
• | A sample schema.ini file is as follows: |
data.txt file:
AARONFIT0001 | Aaron Fitz Electrical Bob Fitz One Microsoft Way |
ADAMPARK0001 | Adam Park Resort Roberta Masouras Suite 98756 |
ADVANCED0001 | Advanced Paper Co. Manoj Monat 545 19th Street South |
ADVANCED0002 | Advanced Tech Satellite System Grant Lasko 8765 66th Ave |
ALTONMAN0001 | Alton Manufacturing Jennifer Rossini P.O.Box 3343 |
AMERICAN0001 | American Science Museum Andrew MacWilliams 789 North Carlton Place |
AMERICAN0002 | American Electrical Contractor Sue Almassy-Wicker 3456 North Calumet Avenue |
ASSOCIAT0001 | Associated Insurance Company Dimitry Rodin 321 Garden Mall |
ASTORSUI0001 | Astor Suites Business Office 987 West Alaska Ave |
ATMORERE0001 | Atmore Retirement Center Jane Donato 567 W 7th St |
schema.ini file:
[data.txt] | the name of the text file. |
ColNameHeader=False | valid options - true if there are column headers else false |
Format=FixedLength | valid options - TabDelimited, Delimited(delimiter character), CSVDelimited |
MaxScanRows=0 | how many rows should be scanned when determining column types. 0 = all rows |
CharacterSet=OEM | valid options - ANSI, OEM, ORM |
Col1="CUSTNMBR" char width 13 | |
Col2="CUSTNAME" char width 31
Col3="CONTACT" char width 19
Col4="ADDRESS" char width 30
See http://msdn.microsoft.com/en-us/library/ms709353.aspx for more information on schema.ini files