ADO Schema.ini: Difference between revisions
m (→File format) |
m (→Fields) |
||
Line 40: | Line 40: | ||
! Parameter !! Description | ! Parameter !! Description | ||
|- | |- | ||
| Coln || The literal string value "Col" plus the number of the column starting with 1 | | Coln || The literal string value "Col" plus the number of the column starting with 1 | ||
|- | |- | ||
| ColumnName || The text name of the column. If the column name contains embedded spaces, you must enclose it in double quotation marks | | ColumnName || The text name of the column. If the column name contains embedded spaces, you must enclose it in double quotation marks | ||
|- | |- | ||
| type || Data types are as follows (Microsoft Jet data types): | | type || Data types are as follows (Microsoft Jet data types): | ||
Line 58: | Line 58: | ||
| Width || The literal string value "Width". Indicates that the following number designates the width of the column | | Width || The literal string value "Width". Indicates that the following number designates the width of the column | ||
|- | |- | ||
| # || The integer value that designates the width of the column (required if Width is specified) | | # || The integer value that designates the width of the column (required if Width is specified) | ||
|} | |} | ||
Example: | Example: |
Revision as of 10:10, 12 January 2014
Schema.ini
Schema.ini files provide schema information about the records in a text file. This, by the way, is optional only when using a delimited file; if you have a fixed-length text file, you must use a Schema.ini file.
Important: Schema.ini must be in the same folder as your text file.
Each Schema.ini entry specifies one of five characteristics of the table:
- The text file name
- The file format
- The field names, widths, and types
- The character set
- Special data type conversions
Text file name
The first entry in Schema.ini is always the name of the text source file enclosed in square brackets. A Separator.ini can hold information for many files:
[File_1.txt] Format=CSVDelimited [File_2.txt] Format=TabDelimited
File format
The Format option in Schema.ini specifies the format of the text file. You can use any single character as a delimiter in the file except the double quotation mark ("). The Format setting in Schema.ini overrides the setting in the Windows Registry, file by file. The list of valid values can be found here. The following table lists the valid values for the Format option.
Format specifier | Table format | Schema.ini Format statement |
---|---|---|
Tab Delimited | Fields in the file are delimited by tabs | Format=TabDelimited |
CSV Delimited | Fields in the file are delimited by commas (comma-separated values) | Format=CSVDelimited |
Custom Delimited | Fields in the file are delimited by any character you choose. All except the double quotation marks (") are allowed, including blank | Format=Delimited(custom character) or with no delimiter specified: Format=Delimited( ) |
Fixed Length | Fields in the file are of a fixed length | Format=FixedLength |
Fields
You can specify fields by column number, column name, data type and width.
Parameter | Description |
---|---|
Coln | The literal string value "Col" plus the number of the column starting with 1 |
ColumnName | The text name of the column. If the column name contains embedded spaces, you must enclose it in double quotation marks |
type | Data types are as follows (Microsoft Jet data types):
|
Width | The literal string value "Width". Indicates that the following number designates the width of the column |
# | The integer value that designates the width of the column (required if Width is specified) |
Example:
Col1=CustomerNumber Text Width 10 Col2=CustomerName Text Width 30
Character Set
You can select from two character sets: ANSI and OEM. The CharacterSet setting in Schema.ini overrides the setting in the Windows Registry, file by file.
Conversions and Data Type Formats
The Schema.ini file contains several options that you can use to specify how data is converted or displayed. The following table lists each of these options.
Option | Description |
---|---|
DateTimeFormat | Can be set to a format string that indicates dates and times. You should specify this entry if all date/time fields in the import/export are handled with the same format. All Microsoft Jet formats except A.M. and P.M. are supported. If there is no format string, the Windows Control Panel short date picture and time options are used. |
DecimalSymbol | Can be set to any single character that is used to separate the integer from the fractional part of a number. |
NumberDigits | Indicates the number of decimal digits in the fractional portion of a number. |
NumberLeadingZeros | Specifies whether a decimal value less than 1 and more than –1 should contain leading zeros; this value can be either False (no leading zeros) or True. |
CurrencySymbol | Indicates the currency symbol that can be used for currency values in the text file. Examples include the dollar sign ($) and Dm. |
CurrencyPosFormat | Can be set to any of the following values:
|
CurrencyDigits | Specifies the number of digits used for the fractional part of a currency amount. |
CurrencyNegFormat | Can be one of the following values:
|
CurrencyThousandSymbol | Indicates the single-character symbol that can be used for separating currency values in the text file by thousands. |
CurrencyDecimalSymbol | Can be set to any single character that is used to separate the whole from the fractional part of a currency amount. |