Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

, within csv

when a csv file has commas in its values, how can we make sure that the field value is imported correctly.

for example:

Bush, George should come in as one field not two.
ASKER CERTIFIED SOLUTION
Avatar of icenick
icenick
Flag of Israel 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
SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands 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
SOLUTION
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
SOLUTION
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
Avatar of 25112
25112

ASKER

the tool requires only csv.. if you put another delimiter, it is not more a csv, right? (comma separated)

i am generating the csv file data from a sql query.. to assign quote or proper length spaces are both going to be a challenge. any thoughts of alternatives?
I would go for option number 2, putting quotes around the field. In your query you can easily add the quotes between the fields like this:

select field1, '"' || field2 || '"', fiel3, field3
from table;

In the (oracle) sample above, field2 is your field that may contain spaces, output will look like this:

value1, "value2-last value2-first", value3

I'm trusting that your query already creates the , separators in the (spooled) output file.
SOLUTION
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
Avatar of 25112

ASKER

good idea.. thanks.