Home > Documentation > MS SQL to PostgreSQL
To perform batch conversion or call conversion procedure from an automation script you can use console version of MSSQL-to-PostgreSQL called M2PAGENT.EXE. Find this file in MSSQL-to-PostgreSQL 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:
--as_dbo | connect to MS SQL server as database owner | ||
--case_sense | make names case sensitive (default is off) | ||
--dest=... | PostgreSQL database or script file | ||
--dump | convert MS SQL database into PostgreSQL file | ||
--help | display help message and exit | ||
--logfile=... | path to the logfile where execution traces will be written | ||
--mode=... | how to process an existing PostgreSQL database (0 - overwrite the entire database, 1 - overwrite existing tables only, 2 - skip existing tables, 3 - merge, 4 - synchronize) | ||
--mssqlh=... | MS SQL server IP address or network name | ||
--mssqlu=... | MS SQL user name | ||
--mssqlp=... | MS SQL user password | ||
--owned | convert tables owned by the user only | ||
--pgport=... | PostgreSQL port | ||
--posgsh=... | PostgreSQL server IP address or network name | ||
--posgsu=... | PostgreSQL user name | ||
--posgsp=... | PostgreSQL user password | ||
--owned | convert tables owned by the user only | ||
--profile=... | path to the file to load conversion settings from | ||
--silent | use this option to disable program output | ||
--skip_idx | skip converting indexes | ||
--src=... | MS SQL database name | ||
--tab_def | convert table definitions only | ||
--tab_file=... | name of the file containing table names to convert (one table name per line) |
In the following example the program converts local MS SQL database "db1" into PostgreSQL database "db1 from mssql" on the remote PostgreSQL server "PostgreSQLhost" using table names file "c:\tabfile1.txt":
M2PAGENT.EXE --src=db1 --dest="db1 from mssql" --posgsh=mysqlhost --posgsu=administrator --posgsp=the_passsword --tab_file=c:\tabfile1.txt
Table names file should be formatted as follows:
Table_1
Table_2
...
Table_N
Notes: