Combining DB2 and SQL Server Data in Power BI

By Tom Nonmacher

As data professionals, we often find ourselves working with diverse databases. Two such databases are IBM's DB2 and Microsoft's SQL Server. Each of these databases offers unique features that can prove beneficial to your organization. However, there are times when we need to combine data from both these databases for analysis and reporting. This is where Power BI, Microsoft's interactive visualization tool, comes in handy. In today's post, we'll walk you through how to combine DB2 and SQL Server data in Power BI.

To start, you'll need to ensure that you have connections to both your DB2 and SQL Server databases. For SQL Server, whether it's SQL Server 2016, SQL Server 2017, or Azure SQL, the connection process is straightforward. Simply select SQL Server from the 'Get Data' option, and input your server details and database name.

For DB2, the process is slightly different. You need to install the IBM DB2 driver on your machine. Once installed, you can then select DB2 from the 'Get Data' option, and input your server details and database name.

Once you have connections to both databases, you can then load data into Power BI. Power BI allows you to load data using SQL queries. For SQL Server, you can use T-SQL to write your query. Here is an example:


-- T-SQL code goes here
SELECT *
FROM Sales.Orders
WHERE OrderDate BETWEEN '2017-01-01' AND '2017-12-31'

For DB2, you can use the DB2 SQL syntax to write your query. Here is an example:


-- DB2 SQL code goes here
SELECT *
FROM HR.EMPLOYEES
WHERE HIRE_DATE BETWEEN '2017-01-01' AND '2017-12-31'

Once you have loaded your data, you can then start combining it. Power BI provides several ways to combine data, such as Append and Merge. Append allows you to stack data from multiple tables with the same structure, while Merge allows you to join data from multiple tables based on common columns.

In conclusion, combining DB2 and SQL Server data in Power BI can be done in a straightforward manner. By creating connections to both databases, loading data using SQL queries, and combining data using Power BI's built-in features, you can create interactive reports that provide insights into your data.

Check out the latest articles from all our sites:

Privacy Policy for sqlsupport.org

Last updated: May 06, 2026

sqlsupport.org respects your privacy and is committed to protecting any personal information you may provide while using this website.

This Privacy Policy document outlines the types of information that are collected and recorded by sqlsupport.org and how we use it.

Information We Collect

  • Internet Protocol (IP) addresses
  • Browser type and version
  • Pages visited
  • Time and date of visits
  • Referring URLs
  • Device type

Cookies and Web Beacons

sqlsupport.org uses cookies to store information about visitors preferences and to optimize the users experience.

How We Use Your Information

  • Operate and maintain our website
  • Improve user experience
  • Analyze traffic patterns
  • Prevent fraudulent activity

Contact

Email: admin@sqlsupport.org




44C936
Please enter the code from the image above in the box below.