?
Solved

How to pass variable in the  Netezza/Postgresql query?

Posted on 2009-05-07
5
Medium Priority
?
1,728 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Suggested Courses

764 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