ZappySys provides high-performance drag and drop connectors for PostgreSQL Integration. In this post you will see how to Execute SQL query against PostgreSQL in SSIS, in various SQL commands such as SELECT, INSERT, DROP, COPY, CREATE, etc using PostgreSQL Execute SQL Task can be used to execute DDL and DML statements for PostgreSQL without needing any extra driver. PostgreSQL is a powerful, open-source relational database with a strong reputation for reliability, feature robustness, and performance.
In nutshell, this post will focus on how to Execute SQL query against PostgreSQL in just a few clicks.
- First, you will need to have SSIS installed
- Secondly, make sure to have SSDT
- Thirdly, You have obtained PostgreSQL Credential.
- Finally, do not forget to install ZappySys SSIS PowerPack
Component Mentioned in this article
What is PostgreSQL?
PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads. The origins of PostgreSQL date back to 1986 as part of the POSTGRES project at the University of California at Berkeley and has more than 30 years of active development on the core platform.
PostgreSQL has earned a strong reputation for its proven architecture, reliability, data integrity, robust feature set, extensibility, and the dedication of the open source community behind the software to consistently deliver performant and innovative solutions. PostgreSQL runs on all major operating systems, has been ACID-compliant since 2001, and has powerful add-ons such as the popular PostGIS geospatial database extender. It is no surprise that PostgreSQL has become the open source relational database of choice for many people and organisations.
Getting started with using PostgreSQL has never been easier – pick a project you want to build, and let PostgreSQL safely and robustly store your data.
Download and Install PostgreSQL
Please go to below download link and download the Windows version Binary package and install it and follow the steps from the installer.
Create a PostgreSQL Database
- To do this, go to Start Menu and search for pgAdmin and we will first open the pgAdmin Panel.
- It will open the pgAdmin Panel in the system default browser. Select Server and Right-click on Databases to create a database.
- Now, Enter the Database name and click on Save to create it.
In order to start, we will show several examples. ZappySys includes an SSIS PostgreSQL ExecuteSQL Task that will help you how to Create and Drop table by Execute SQL query against PostgreSQL in SSIS. ZS PostgreSQL ExecuteSQL Task support execute queries against PostgreSQL without ODBC driver, load query at runtime from variable, file or Direct value, 100% Managed code means its 32bit and 64bit compatible, you can issue COPY, UNLOAD commands very easily, Support for SQL Server 2017, 2016, 2014, 2012, 2008 (32/64 bit) and Click here to see articles related to PostgreSQL.
You can connect to your PostgreSQL database by entering your PostgreSQL credentials.
Execute SQL query against PostgreSQL in SSIS
Let’s start with an example. In this tutorial, we will learn how to Create and Drop table using SQL query against PostgreSQL server using ZS PostgreSQL ExecuteSQL Task.
- In order to connect to the PostgreSQL Database from SSIS, you will need Credentials. Ask your SysAdmin or responsible person to provide that to you.
- Once you finished the above steps, Open Visual Studio and Create New SSIS Package Project.
- In Visual Studio, drag and drop the ZS PostgreSQL ExecuteSql Task in the design surface.
- We need a PostgreSQL Database connection. Click here to create a connection.
- Now, double click on ZS PostgreSQL ExecuteSql Task to configure it.
- In the PostgreSQL ExecuteSql Task, add the following SQL code to DROP a table if it exists and CREATE a table named pg_equipment in the SQL Statement section.
You can replace the table name from the following code.
12345678DROP TABLE IF EXISTS playground_equip;CREATE TABLE pg_equipment (equip_id serial PRIMARY KEY,type varchar (50) NOT NULL,color varchar (25) NOT NULL,location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),install_date date);
- In the above step, you can Select Variable as Sql Source Type.
- Click OK to save ZS PostgreSQL ExecuteSql Task UI settings.
- Finally, Right Click on Task and Select Execute Task to run it.
After all, In this blog, we learned Execute SQL query against PostgreSQL in SSIS using ZS PostgreSQL ExecuteSQL Task. You can download SSIS PowerPack here to try many other scenarios not discussed in this blog along with 70+ other components.
Finally, you can use the following links for more information: