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.
for example:
Bush, George should come in as one field not two.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
good idea.. thanks.
ASKER
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?