Solved

How to pass variable in the  Netezza/Postgresql query?

Posted on 2009-05-07
5
1,637 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
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:PedroCGD
Comment Utility
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
Comment Utility
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
Comment Utility
no... the source component you are using in SSIS... OLEDB Destination? Data Reader Source?
0
 

Author Comment

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

Accepted Solution

by:
PedroCGD earned 500 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now