SELECTING ROWS FROM A FILE
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 30
- Joined: Fri May 26, 2006 6:01 am
SELECTING ROWS FROM A FILE
Hi All,
while loading data from input file to ODBC i want to select rows basing on distinct values from a column.
In oracle data base if we want to select the records from a data base we will use "SELECT DISTINCT COLUMN_NAME FROM TABLE_NAME".
how can i apply this logic while loading data from file to odbc.
Waiting for your reply
while loading data from input file to ODBC i want to select rows basing on distinct values from a column.
In oracle data base if we want to select the records from a data base we will use "SELECT DISTINCT COLUMN_NAME FROM TABLE_NAME".
how can i apply this logic while loading data from file to odbc.
Waiting for your reply
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
1) Load it into a work table first, then 'select distinct' from there to your target table.
2) Sort your data based on that field, then use stage variables to only pass the row with the first occurance of 'column name'.
3) Load into a hashed file keyed on 'column name' then source to ODBC from there.
4) Use a hashed reference with 'column name' as key. Lookup and also write to it. Miss = record to ODBC and hashed file. Hit = duplicate to pitch.
There's four ways off the top of my head...
2) Sort your data based on that field, then use stage variables to only pass the row with the first occurance of 'column name'.
3) Load into a hashed file keyed on 'column name' then source to ODBC from there.
4) Use a hashed reference with 'column name' as key. Lookup and also write to it. Miss = record to ODBC and hashed file. Hit = duplicate to pitch.
There's four ways off the top of my head...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 30
- Joined: Fri May 26, 2006 6:01 am
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
When reading the file, use sort -u as a filter command in the Sequential File stage.
Or, if you want a really slow solution, use the ODBC driver for text files, and use your SQL statement from an ODBC stage.
Or, if you want a really slow solution, use the ODBC driver for text files, and use your SQL statement from an ODBC stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kim has mentioned the option available in both Server and PX. You still left out with manual option. Open in a text editior and pick up the required column.kduke wrote:If you are talking about removing duplicates then you can search for this. There are lots of posts on removing duplicates. You can do it using a hash file or land your data in a staging table and then select distinct.
![Laughing :lol:](./images/smilies/icon_lol.gif)
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'