SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Import of CSV file only inserting half the rows


Import of CSV file only inserting half the rows

Author
Message
miles_lesperance
miles_lesperance
SSC-Enthusiastic
SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)

Group: General Forum Members
Points: 165 Visits: 101
I am running into an issue where only half of the rows from a csv file are getting inserted into a table. Using the Data Viewer, it appears as though it is only grabbing every other line from the file, starting with the third line (which is the second line of data), as the first one is the column headers, and the second one is the first line of data. The file is Delimited, with "," as the Column Delimiter.

The Flat File Source is setup with the following:
Format: Delimited
Text Qualifier: <none>
Header Row Delimiter: {CR}-{LF}

There are column headers in the first row, and it is marked in the Flat File Source as such. I also have RowDelimiter as the last column in the Flat File Source, too. It has a 0 Output Column Width, {CR}-{LF} as the Column Delimiter, and TextQualified set to "True".

I have tried modifying the Flat File Source to either just {CR} or {LF} as the Header Row Delimiter, but that did not change the results at all. I also opened the csv file in ConText editor, and all of the commas are accounted for each of the columns, and that there is a Line Feed/Carriage Return at the end of each row.

I am looking for any further troubleshooting tips, and possible causes of why only every other line in the file is getting processed. Does anyone have any suggestions?
miles_lesperance
miles_lesperance
SSC-Enthusiastic
SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)

Group: General Forum Members
Points: 165 Visits: 101
I was able to work through the issue, and can now get all of the rows to be inserted. The file that I was trying to import did not take in account for a RowDelimiter, so eliminating that field in the Flat File Source, and setting the previous column to Column Delimiter = {LF} enabled all rows to show. :-)
Phil Parkin
Phil Parkin
SSC-Forever
SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)

Group: General Forum Members
Points: 48574 Visits: 21125
miles_lesperance (11/19/2013)
I was able to work through the issue, and can now get all of the rows to be inserted. The file that I was trying to import did not take in account for a RowDelimiter, so eliminating that field in the Flat File Source, and setting the previous column to Column Delimiter = {LF} enabled all rows to show. :-)


Well done and thanks for posting back - by doing so, you'll probably help others in future.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search