Skip to main content
Inspiring
February 23, 2010
Answered

csv file creation - output contains comma - work around?

  • February 23, 2010
  • 2 replies
  • 644 views

Greetings,

Question is:

Is there a way to get around database information containing commas

when creating csv files?

I have the process down for creating a .csv file and storing to the server and

or e-mailing it out. The problem I have, is that one of the db fields being pulled

from the database has a comma in it and thus causes problems for me in

creating the csv file.

DB fields:

-- emp_number

-- emp_name (last_name, first_name)

-- activity_code

-- report_date

-- time_total

When the file is created it recognizes the comma in the emp_name field

and separates the last name and the first name and creates separate

columns for them in the csv file which do not match up with the db field

names in row 1 of the csv.

I have already searched the forum to see if this was asked before. Either

my eyes are too crossed from all the reading or i am not entering the

appropriate search criteria.

Any assistance will be greatly appreciated.

Leonard

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    double quote the data part.

    2 replies

    Inspiring
    February 23, 2010

    It might be an idea to familiarise yourself with the "spec" for CSV data:

    http://en.wikipedia.org/wiki/Comma-separated_values#Basic_Rules

    --

    Adam

    Leonard_BAuthor
    Inspiring
    February 24, 2010

    A Cameron,

    Thanks for the link to the information that helped me understand better the

    workings of csv files/creation of.

    Leonard

    Dan_BracukCorrect answer
    Inspiring
    February 23, 2010

    double quote the data part.

    Leonard_BAuthor
    Inspiring
    February 24, 2010

    Hi Dan,

    Thanks for the response, that did the trick.

    I was not aware of the double quote thing within csv files now I do.

    Leonard