"" <> wrote:
> Hi All,
>
> I have a series of large CSV files (the largest is several GB) that I
> need to load into SQL.
SQL is a language. You cannot insert data into a language. What is the
SQL-processing database server you are trying to use?
> 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.
I don't know "BULK INSERT", but I do know Oracles sqlldr and MySQL's
"LOAD DATA" or mysqlimport. Both of them allow you specify a "Fields
enclosed by" character, such they can take your large data files just as
they are. I would be very surprised if "BULK INSERT" is not similarly
configurable.
> 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?
Text::CSV_XS
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB