SSIS PostgreSQL ExecuteSQL Task
PreviousNext

PostgreSQL ExecuteSql Task can be used to execute sql query against PostgreSQL. With this task you do not need additional driver to execute PostgreSQL queries.

Download SSIS PowerPack

Video Tutorial


Coming soon...

Content

Video Tutorial

Coming soon...

Step-By-Step

In this tutorial we will learn how to Create and Drop table sql query against PostgreSQL server using ZS PostgreSQl ExecuteSQL Task.
  1. Firstly, You need to Download and Install PostgreSQL Database.
  2. In order to connect to PostgreSQL Database from SSIS you will need Credentials. Ask your SysAdmin or responsible person to provide that to you.
  3. Once you finished above steps, Open Visual Studio and Create New SSIS Package Project.
  4. In Visual Studio, drag and drop the ZS PostgreSQL ExecuteSql Task in the design surface.
    SSIS postgresql executesql task - Drag and Drop
  5. We need PostgreSQL Database connection.
  6. Right click on Connection Manager and select New Connection.
    ssis-postgresql-create-new-connection
  7. Here, Select ZS-POSTGRESQL Connection Manager from the Connection Managers list and Click on Add Button.
    ssis-postgresql-create-new-connection
  8. On Connection Manager UI, Enter Host name and Enter your PostgreSQL Username and Password even Database Name and leave all other properties as it is.
    ssis-postgresql-create-new-connection
  9. Click on Test Connection if test successful then hit OK to save the connection manager setting UI.
  10. Now, double click on ZS PostgreSQL ExecuteSql Task to configure it.
  11. 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 table name from the following code.
    DROP 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
    );
    
    ssis-postgresql-task-create-table
  12. In the above step you can Select Variable as Sql Source Type.
  13. Click OK to save ZS PostgreSQL ExecuteSql Task UI settings.
  14. Finally, Right Click on Task and Select Execute Task to run it.

Properties

Property Name Description
ResultsetType ResultSet Type. It can be None, FullResultset or SingleValue. When FullResultset is specified then you have to store result in Object type variable. Full result is ADO.net DataTable. SingleValue is Object datatype

Available Options

Option Description
None None
FullResultset FullResultset returns an ADO record set.
SingleValue SingleValue returns one value.
SqlStatementSourceType Source of SQL Statement. It can be DirectValue or Variable

Available Options

Option Description
DirectValue DirectValue allows to write the SQL statements directly.
Variable Variable allows to use the SQL query stored in a variable.
ResultsetVariable Variable name which will store Full resultset (ADO.net DataTable) or single value of result. Variable type must be object datatype if storing full resultset
Timeout Command timeout in second. 0 means no command timeout
SqlStatementSource If SqlSourceType=DirectValue then this property holds SQL Statement.
SqlStatementVariable If SqlSourceType=Variable then this property holds Variable name which where SQL statement is stored
Connection Connection where you want to execute sql command
LoggingMode

Available Options

Option Description
Normal Normal
Medium Medium
Detailed Detailed
Debugging Debugging
PrefixTimestamp When you enable this property it will prefix timestamp before Log messages.

Setting UI

ssis-postgresql-task- Setting UI
ssis-postgresql-task- Setting UI

References

See Also

Articles / Tutorials

Click here to see all articles for [SSIS PostgreSQL ExecuteSQL Task] category
Execute SQL query against PostgreSQL in SSIS

Execute SQL query against PostgreSQL in SSIS

Introduction 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 […]



Copyrights reserved. ZappySys LLC.