Link to home
Start Free TrialLog in
Avatar of PKTG
PKTGFlag for United States of America

asked on

How to pass variable in the Netezza/Postgresql query?

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.
Avatar of PedroCGD
PedroCGD
Flag of Portugal image

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
Avatar of PKTG

ASKER

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
no... the source component you are using in SSIS... OLEDB Destination? Data Reader Source?
Avatar of PKTG

ASKER

ODBC conectivity. SOme time i used OLEDB also to connect Netezza.
ASKER CERTIFIED SOLUTION
Avatar of PedroCGD
PedroCGD
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial