Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Import of CSV file only inserting half the rows Expand / Collapse
Author
Message
Posted Tuesday, November 19, 2013 10:05 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 17, 2014 8:13 AM
Points: 23, Visits: 82
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?
Post #1515663
Posted Tuesday, November 19, 2013 12:14 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 17, 2014 8:13 AM
Points: 23, Visits: 82
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.
Post #1515722
Posted Wednesday, November 20, 2013 12:27 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: 2 days ago @ 11:49 PM
Points: 4,973, Visits: 11,660
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.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1515919
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse