To perform batch conversion or call conversion procedure from an automation script you can use console version of DBF to SQL Server converter called D2MAGENT.EXE. Find this file in the installation folder. You can either run this tool directly from command line or call it from any script as well. The program supports the following command-line options:
--dest=... | MS SQL database name | |
--encoding=... | decode all text fields using DBase codepage specified (see the table below) | |
--help | display help message and exit | |
--log2int | convert DBase logical fields into MS SQL TINYINT(1) according to ANSI standard (true=1, false=0) | |
--logfile=... | path to the logfile where execution traces will be written | |
--mode=... | how to process an existing MS SQL database (0 - overwrite the entire database, 1 - overwrite existing tables only, 2 - skip existing tables, 3 - merge) | |
--mssqlh=... | MS SQL server IP address or network name | |
--mssqlu=... | MS SQL user name | |
--mssqlp=... | MS SQL user password | |
--profile=... | path to a profile to load conversion settings from | |
--silent | use this option to disable program output | |
--skip_del | don't convert records marked as deleted | |
--src=... | path to DBF database | |
--tab_def | convert table definitions only | |
--tab_file=... | file containing table names to convert (one table name per line) |
In the following example the program converts DBF database located in "c:\db 1" folder into MS SQL database "db 1" on MS SQL server "mssqlhost":
D2MAGENT.EXE --src="c:\db 1" --dest="db 1" --mssqlh=mssqlhost
Notes:
Usually code page is stored in the header of .dbf file and extracted by converter automatically. But if it is not happened, you may specify code page manually via '--encoding=...' command line parameter. Below is the list of acceptable values:
0 | Use default encoding (from header of .dbf file) | |
1 | U.S. MS-DOS | |
2 | International MS-DOS | |
3 | Windows ANSI | |
4 | Standard Macintosh | |
38 | 866 DOS Russian | |
87 | 1251 Windows ANSI | |
100 | Eastern European MS-DOS | |
101 | Russian MS-DOS | |
102 | Nordic MS-DOS | |
103 | Icelandic MS-DOS | |
104 | Kamenicky (Czech) MS-DOS | |
105 | Mazovia (Polish) MS-DOS | |
106 | Greek MS-DOS (437G) | |
107 | Turkish MS-DOS | |
150 | Russian Macintosh | |
151 | Eastern European Macintosh | |
152 | Greek Macintosh | |
200 | Eastern European Windows | |
201 | Russian Windows | |
202 | Turkish Windows | |
203 | Greek Windows |