Solved

How to pass variable in the  Netezza/Postgresql query?

Posted on 2009-05-07
5
1,675 Views
Last Modified: 2013-11-10
In Netezza database i have table called TableA. This table has many vendor details. Now i need to create .CSV file for each vendor details in the particular folder. File name like "VendorNo_YYYYMMDD.csv" with the help of "create external table command". First thing I don't know how to loop through each vendor no in Netezza query.
 
So i plan to use SQL Server SSIS package. And loop through each vendor number and try to pass this vendor number variable in where condition. Since Netezza doesn't have Stored procedure option with our existing version, i don't know how to pass vendor number variable in the where condition.
 
This task i need to do every day.
 
Please help me. Thanks in advance.
0
Comment
Question by:PKTG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:PedroCGD
ID: 24334813
Which is the source you are using to get data from PostgreSQL?
You should pass the query to the source as an expression... inside a for each loop...
Regards,
Pedro
www.pedrocgd.blogspot.com
0
 

Author Comment

by:PKTG
ID: 24337453
I am using Netezza database . It is almost similar to Postgresql. Can you please explain little more. Or if you have example please share with me. I need to pass same query but different venodr no every time in the where class.
Select * from TableA where vendor_No= vintvendorno  -- it is variable name for vendor number.
Thanks
0
 
LVL 22

Expert Comment

by:PedroCGD
ID: 24337630
no... the source component you are using in SSIS... OLEDB Destination? Data Reader Source?
0
 

Author Comment

by:PKTG
ID: 24340375
ODBC conectivity. SOme time i used OLEDB also to connect Netezza.
0
 
LVL 22

Accepted Solution

by:
PedroCGD earned 500 total points
ID: 24352355
PKTG,
Add a dataflow to your control flow.
In the connection manager create a ADO.NET connection
Inside dataflow add a Data Reader Source and add a SQL query...
ok?
Now, to set it dinamically, go to dataflow, go to properties and pass the query insert before as an expression... see the attached image...
helped?
regards,
Pedro
www.pedrocgd.blogspot.com
SSIS-Expression.JPG
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question