Connecting MsSQL to PostgreSQL: 2 Easy Methods

Orina Mark • Last Modified: September 6th, 2023

MsSQL to PostgreSQL | Hevo Data

Database technology has been growing rapidly today and new innovations in this field are becoming quite common. Nowadays, many tools help you connect different databases with each other so that you can use the advantages of both technologies. One such process is connecting MsSQL to PostgreSQL.

Both MsSQL and PostgreSQL are widely used databases in big and small companies. They are widely used relational database tools that share several key similarities as well as differences. It is important to understand the key characteristics of both these databases in order to set up a connection between them.

This article provides a comprehensive guide on connecting MsSQL to PostgreSQL. It also provides a general overview of both MsSQL and PostgreSQL to better understand these technologies individually. Furthermore, you will also come across a  few limitations of this process. Read along to find out how you can connect MsSQL to PostgreSQL for your business.

Table of Contents


Before connecting MsSQL to PostgreSQL, below are some of the factors you should keep in mind:

  • Your data sources should be configured with system DSNs. 
  • Ensure that ODBC Driver for both PostgreSQL and SQL Server are installed on the same PC.
  • You should install .NET Framework 4.5 on your computer. 
  • Ensure that the driver, studio, and SQL Server are of the same bitness. 

Once all these factors are in check, you can now get down to connecting your MsSQL to PostgreSQL. In the tutorial, we will use Linked Server, a tool in MsSQL that allows you to execute commands and refer to data stored in Non-SQL databases. With this tool, you can link to the information stored in PostgreSQL and merge it with that stored in your MsSQL database.

What is Microsoft SQL Server?

MsSQL to Postgres: MsSQL Logo | Hevo Data
Image Source

MsSQL (or SQL Server) is a proprietary database storage and management tool developed by the global software company Microsoft. Depending on your organizational or personal needs, you can get the license on a per-core model or a Client Access Level model (CAL). Microsoft offers the software in two different editions, Enterprise and Standard. Finally, the software is primarily used in E-Commerce settings to provide various data warehousing solutions. 

Key Features of Microsoft SQL Server

Microsoft SQL Server houses a wide range of features that make it a unique option over other databases. Some of those features are:

  • It offers support for different tools such as SQL Server Management Studio, Database Tuning Advisor, SQL Server profiler, and BI tools. 
  • Online help and live support. 
  • Database engine with SQL support and other high-level languages, including Java. 
  • The Database engine is helpful for backend programming when building applications that support SQL. 
  • Intelligent Query Processing Enhancements- This is AI technology that improves the query optimizer output making SQL Server more efficient.

What is PostgreSQL?

MsSQL to Postgres: Postgres Logo | Hevo Data
Image Source

Unlike SQL, Postgres (or PostgreSQL) is open-source software licensed under PostgreSQL. The software is freely distributed in both commercial and personal settings. One of the most significant aspects that separate PostgreSQL from MsSQL is that it supports more advanced features such as foreign keys and triggers. 

Key Features of PostgreSQL

PostgreSQL houses a wide range of features that make it a unique option over other databases. Some of those features are:

  • It’s compatible with several operating systems, including Linux, Unix, Windows, and macOS.
  • Compatible with Data integrity and supports primary keys, foreign keys, and exclusion constraints. 
  • It also supports various features native to SQL, including multi-conversion currency control, SQL sub-selects, and complex SQL queries. 
  • It is compatible with several data types such as arrays, integers, and boolean. 

With this in mind, the fundamental purpose of this tutorial is to give you a stepwise tutorial on how you can connect MsSQL to PostgreSQL. Below are some of the benefits you stand to gain by performing this relatively straightforward process:

  • You can manipulate different data sources in the same way. 
  • You can apply distributed queries across a diverse data set.
  • You can relate several databases in the same or remote server.

Why Connect MS SQL Server to PostgreSQL?

MS SQL Server offers a vast and diverse collection of techniques for putting data into a database as a feature-rich and mature solution. The SQL Server Import and Export Wizard is one method for importing data into your database. You will be able to bulk load data from a variety of supported data sources using it and a visual interface.

PostgreSQL runs on a variety of platforms, including Linux, Unix, Windows, and Mac OS X. Supports primary keys, foreign keys, and exclusion constraints and is compatible with data integrity. It also supports various features native to SQL, including multi-conversion currency control, SQL sub-selects, and complex SQL queries. It is compatible with several data types such as arrays, integers, and boolean. 

Connecting the two platforms will help you gain the best out of your Data. You will be able to transform the data in a more efficient way.

Simplify MsSQL to PostgreSQL Connection Using Hevo’s No Code Data Pipeline

Method 1: Manual MsSQL to PostgreSQL Connection

In this method, you will use a Linked Server, a tool available in MsSQL that allows you to write and execute commands on Non-SQL databases. This way you can connect the MsSQL data to PostgreSQL easily.

Method 2: Using Hevo Data to Connect MsSQL to PostgreSQL

Hevo Data, an Automated No Code Data Pipeline provides you with a hassle-free solution to connect MsSQL to PostgreSQL within minutes with an easy-to-use no-code interface. Hevo is fully managed and completely automates the process of not only loading data from MsSQL but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code.

Hevo’s fault-tolerant Data Pipeline offers a faster way to move data from databases or SaaS applications into your PostgreSQL account. Hevo’s pre-built integration with MsSQLalong with 100+ other data sources (and 40+ free data sources) will take full charge of the data transfer process, allowing you to focus on key business activities.

What are the Methods to Connect MsSQL to PostgreSQL?

There are 2 methods you can use to connect Microsoft SQL Server to PostgreSQL:

Method 1: Manual MsSQL to PostgreSQL Connection

Connecting MsSQL to PostgreSQL does not take a significant amount of time if you use this method and is a pretty straightforward process. You need to go to your Object Explorer and follow the given steps to set up the connection:

Step 1: Create a Linked Server in MsSQL

To perform this step follow the given procedure:

  • Start your MsSQL management studio and choose ‘SQL Server Instance.’ 
  • Head on to the Object Explorer pane and click on ‘Server Objects’ to expand. Locate Linked Servers and click to create a new Linked Server. 
  • Once the new dialog box appears, perform the following: 
    • Name your Linked Server.
    • Next, once prompted to specify the server type, click on ‘Other Data Source.’
    • A drop-down list with providers will appear. Select ‘Microsoft OLE DB Provider for ODBC Drivers.’
    • Finally, key in the name of your DSN in the Data Source Field.

Once you have performed all these steps, you will notice a Linked Server appearing in the object explorer pane. As mentioned earlier, Linked Servers allow you access to data stored in Non-SQL sources such as PostgreSQL. Hence, you can now distribute queries to and access data stored in PostgreSQL. 

Step 2: Access the Data Stored in PostgreSQL

Now that we have successfully added the linked server option in the Object Explorer pane here comes the fun part, accessing data stored in PostgreSQL. You should adhere to a set of steps for you to access your data successfully.

  • First, head to the provider’s section, and under the list, locate ‘MSDASQL OLE DB’ and double-click on it as illustrated below:
MsSQL to PostgreSQL: Provider's Section | Hevo Data
Image Source: Self
  •  Once you double click, a list of provider options will appear as shown: 
MsSQL to PostgreSQL: Provider Options | Hevo Data
Image Source: Self
  • Disable the ‘Allow Inprocess’ option, which is illustrated above. Once this is done, create a new Linked Server under the Object Explorer pane as shown below.
MsSQL to PostgreSQL: New Linked Server | Hevo Data
Image Source: Self
  • Under providers, ensure you click on ‘Microsoft OLE DB Provider‘ for ODBC Drivers and specify the following:
MsSQL to PostgreSQL: Parameters | Hevo Data
Image Source: Self

This is all you have to do, and you will now get access to the data in PostgreSQL. You can query your linked server by clicking ‘New Query’ in the toolbar. 

That’s it! You have successfully connected MsSQL to PostgreSQL using the Manual Method!

One limitation of this method includes:

  • Creating a linked server with the ‘Allow Inprocess’ option enabled. –Always disable this option when creating the server, and in case you forget, just delete and repeat the process. 

To overcome this limitation, and several others, and connect MsSQL to PostgreSQL quickly and efficiently, you can use Hevo’s No-code Data Pipelines. Check out the next method to understand how Hevo can help you connect them within minutes.

Method 2: Using Hevo Data to Connect MsSQL to PostgreSQL

MsSQL to PostgreSQL: Hevo Logo | Hevo Data
Image Source

Hevo Data, an Automated Data Pipeline helps you directly transfer data from MsSQL to PostgreSQL in a completely hassle-free & automated manner. Hevo is fully managed and completely automates the process of not only loading data from your desired source but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Hevo takes care of all your data preprocessing needs required to set up MsSQL to PostgreSQL Integrations and lets you focus on key business activities

Hevo’s fully managed pipeline supports data replication from SQL Servers hosted either on-premises or on the Azure cloud. Moreover, Hevo supports data ingestion replication from PostgreSQL servers via Write Ahead Logs (WALs) set at the logical level. A WAL is a collection of log files that record information about data modifications and data object modifications made on your PostgreSQL server instance.

The following steps can be implemented to connect MsSQL to PostgreSQL using Hevo:

  • Configure Source: Connect Hevo Data with Microsoft SQL Server by providing a unique name for your destination along with your database credentials such as username and password. To help Hevo connect with your Microsoft SQL Server database, you will also have to provide information such as the host IP, port number, and the name & schema of your database.
MsSQL to Postgres: Configuring SQL Server Source | Hevo Data
Image Source
  • Integrate Data: Load data from Microsoft SQL Server to PostgreSQL by providing your PostgreSQL database credentials, such as your authorized username and password, along with information about your host IP and port number value. You will also need to provide a name for your database and a unique name for this destination. You can also configure the type of connection you want to establish, choosing between SSH and SSL.
MsSQL to PostgreSQL: Configure Postgres as Destination | Hevo Data
Image Source

Check out what makes Hevo amazing:

  • Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Auto Schema Mapping: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data from MsSQL files and maps it to the destination schema.
  • Quick Setup: Hevo with its automated features, can be set up in minimal time. Moreover, with its simple and interactive UI, it is extremely easy for new customers to work on and perform operations.
  • Transformations: Hevo provides preload transformations through Python code. It also allows you to run transformation code for each event in the Data Pipelines you set up. You need to edit the event object’s properties received in the transform method as a parameter to carry out the transformation. Hevo also offers drag-and-drop transformations like Date and Control Functions, JSON, and Event Manipulation to name a few. These can be configured and tested before putting them to use for aggregation.
  • Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  • Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  • Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.

With continuous Real-Time data movement, Hevo allows you to combine MsSQL data along with your other data sources and seamlessly load it to Postgres with a no-code, easy-to-setup interface. Try our 14-day full-feature access free trial!

Get Started with Hevo for Free

Migrate from MS SQL Server to PostgreSQL using Migration Toolkit

Installation instructions for EnterpriseDB’s Migration Toolkit

  • Step 1: Open the Application Stack Builder first. When you download PostgreSQL, you also get Stack Builder.
MsSQL to PostgreSQL: Migrate S1 | Hevo Data
Image Source
  • Step 2: Choose the PostgreSQL server on which the Migration Toolkit will be installed. Ensure that you have access to the Internet.
MsSQL Server to PostgreSQL: Migrate S2 | Hevo Data
Image Source
  • Step 3: The wizard will display the available applications for installation. Go to EnterpriseDB Tools > Categories > Registration-required and trial packages. Check the Migration Toolkit and then move on to the next step.
MsSQL Server to PostgreSQL: Migrate S3 | Hevo Data
Image Source
  • Step 4: You’ll be prompted to choose a download location. Select the folder you wish to download to and then click Next. You will be requested to install the Migration Toolkit after it has been downloaded. The Migration Toolkit is ready to use once it has been installed.

Building the File

The file is required to give the source and target databases’ configuration and connection information.

Step 1: Open the file first. The file will be found in the following folder on Windows:

C:Program Filesedbmtketc

Step 2: Edit the file with your preferred editor. The following information should be included in the file:

  • SRC_DB_URL : specifies the source database’s connection details.
  • SRC_DB_USER : defines the source database’s username.
  • SRC_DB_PASSWORD : provides the source database’s password.
  • TARGET_DB_URL : specifies the target database’s connection details.
  • TARGET_DB_USER : provides the target database’s username.
  • TARGET_DB_PASSWORD : specifies the target database’s password.

The database’s URL must be in the following format:


A sample file using SQL Server as the source database and PostgreSQL as the target database can be found here.

MsSQL Server to PostgreSQL: Migrate Toolkit | Hevo Data
Image Source

How to verify Database Migration Connection?

To verify a database migration connection, you will need to perform the following steps:

  • Step 1: Establish a connection to the source database. This can typically be done using a database client or library in your programming language of choice. You will need to provide the necessary connection details, such as the hostname, port number, username, and password.
  • Step 2: Test the connection. Once you have established a connection to the source database, you can test it by running a simple query, such as SELECT 1. This will verify that the connection is working and that you are able to communicate with the source database.
  • Step 3: Establish a connection to the target database. Follow the same steps as above to establish a connection to the target database.
  • Step 4: Test the connection to the target database. Run a simple query on the target database to verify that the connection is working and you are able to communicate with the target database.
  • Step 5: Begin the migration. Once you have verified that both the source and target database connections are working, you can begin the process of migrating the data from the source database to the target database. This can typically be done using a database migration tool or by writing custom scripts to transfer the data.

It’s important to note that the exact steps for verifying a database migration connection will depend on the specific databases and tools you are using. If you are having difficulty establishing a connection or running queries, it may be helpful to refer to the documentation for your database client or migration tool.

What can you achieve by migrating data from MsSQL to Postgres?

Microsoft’s SQL Server is a proprietary database, whereas PostgreSQL is an open-source database developed and maintained by a global community of developers. If price is a consideration, PostgreSQL is the way to go. Here’s where you can find out how much it costs.

PostgreSQL is a cross-platform database engine that runs on Windows, Mac, Solaris, FreeBSD, and Linux, whereas SQL Server is exclusively available for Windows. PostgreSQL is open source and free, whereas MSSQL Server costs vary depending on the number of users and database size.

AWS, Google Cloud, and other public cloud providers offer flexible open-source licensing and easy availability. To boost performance, take advantage of open-source add-ons.


This article gave you a step-by-step guide on connecting MsSQL to PostgreSQL. It also gave you an overview of both MsSQL and PostgreSQL along with their features. Overall, connecting MsSQL to PostgreSQL can be done using either the manual method or by using Hevo. You will need to implement it manually, which will consume your time & resources and is error-prone. Moreover, you need full working knowledge of the backend tools to successfully implement the in-house Data transfer mechanism. You will also have to regularly map new MsSQL data to Postgres as the AWS Pipeline is not fully managed.

Hevo Data provides an Automated No-code Data Pipeline that empowers you to overcome the above-mentioned limitations. Hevo caters to 100+ data sources (including 40+ free sources) and can seamlessly transfer your data from MsSQL to PostgreSQL within minutes. Hevo’s Data Pipeline enriches your data and manages the transfer process in a fully automated and secure manner without having to write any code. It will make your life easier and make data migration hassle-free.

Learn more about Hevo

Want to take Hevo for a spin? Signup for a 14-day free trial and experience the feature-rich Hevo suite firsthand.

Share your understanding of the MsSQL to Postgres Migration in the comments below!

No-code Data Pipeline For PostgreSQL