Hi,
In the current project, we have a job processing the .csv files (source is the .csv file) and finally loads the data into SQL database. Within the .csv file, have the data of varchar data type, mostly names fields. After fetching the data from this file, these names fields data will be looked up in the SQL database tables, and will be retrieving the corresponding ID field values, when the names exist.
Issue is: In the .csv file one name field has a valid name. This name does exist in the SQL dataabase, but the lookup is failing, hence this record is getting rejected. When I queried the database for this name (copied the name from .csv file), its not returning any rows. But if I type the same name manually in the Query Analyzer and execute the query, then it's returning the record.
But both the names are same. But, why its not returning teh record in the first case.
Please advise.
Thanks,
Lookup failing though data exists
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 503
- Joined: Wed Jun 29, 2005 8:14 am
Usually occurs when the CSV files have extra spaces in between the names or after or before the name. Trim may remove the issue but u will have to put trim in both the stages , lookup ad well the source or the names which have spaces in the DB will get rejected.
Testing - You can change the query by saying :LIKE the value you copied from teh CSV file and go on removing the spaces and see what exactly is stored in the DB and what is in CSV.
Testing - You can change the query by saying :LIKE the value you copied from teh CSV file and go on removing the spaces and see what exactly is stored in the DB and what is in CSV.