Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manually Parsing a CSV file.

Status
Not open for further replies.

stuartgmilton

Programmer
Nov 12, 2001
66
GB
Hi folks,

I have a DTS job which imports a csv file overnight on a daily basis. Unfortunately, one of the columns has started to have double quotes entered into it, this causes the datapump to fail.

Does anyone know if it is possible to programatically run through the file adding a second double quote where necessary?

Any help would be appreciated.

Stu
 
comma comma is an empty numeric field
comma string comma is a numeric field with a value
comma quote quote comma is an empty string field
comma quote string quote comma is a string field with a value
comma quote string quote string quote comma is a bad field
therefore the enclosed quote should be replaced

comma quote string quote string ... quote string quote comma
requires multiple replacements for each enclosed quote

This could be a pre-process, how you would automate it or include it in the DTS package I dont know.

As to the replacement value, rather than "" for " I would use a back tick ` or possibly a character entity " because the quote mark is just going to cause more trouble.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top