Migrating tables from PostgreSQL to MSSQL Server


If your user account has permission you can set the trusted_connection to true and there is no need to add uid and password info.

ogr2ogr -f "MSSQLSpatial" "MSSQL:server=servername;database=databasename; "postgresservername user=user dbname=postgresdatabasename password=****" "postgrestablename"

If, however, you need to connect using different credentials set the trusted_connection to false and that will force the tool to use the uid and password provided.

ogr2ogr -f "MSSQLSpatial" "MSSQL:server=servername;database=databasename;trusted_connection=false;uid=user;password=****" PG:"host=postgresservername user=user dbname=postgresdatabasename password=****" "postgrestablename"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s