D
dumbledad
Hi All,
I have a series of large CSV files (the largest is several GB) that I
need to load into SQL. To perform the load I'm hoping to use the SQL
command BULK INSERT. But I have a problem, I have lines in the CSV file
like the second one here:
12,some text,34
56,"some text, with a comma in",78
The BULK INSERT command fails to understand the significance of the
quotation marks and treats the second comma in the second line as a
delimiter.
Thus I would like to replace each occurrence of a comma in the files,
when and only when used as a separator, with a different separator ("/"
for example). Does anyone have a Perl script they can share with me
that will do this, i.e. that will find and replace commas which are not
enclosed in text within quote marks?
Cheers,
Tim.
I have a series of large CSV files (the largest is several GB) that I
need to load into SQL. To perform the load I'm hoping to use the SQL
command BULK INSERT. But I have a problem, I have lines in the CSV file
like the second one here:
12,some text,34
56,"some text, with a comma in",78
The BULK INSERT command fails to understand the significance of the
quotation marks and treats the second comma in the second line as a
delimiter.
Thus I would like to replace each occurrence of a comma in the files,
when and only when used as a separator, with a different separator ("/"
for example). Does anyone have a Perl script they can share with me
that will do this, i.e. that will find and replace commas which are not
enclosed in text within quote marks?
Cheers,
Tim.