In order to simulate the issue that you are facing, I created the following sample using SSIS 2008 R2
with SQL Server 2008 R2
backend. The example is based on what I gathered from your question. This example doesn't provide a solution but it might help you to identify where the problem could be in your case.
Created a simple CSV file with two columns namely order number and order date. As you had mentioned in your question, values of both the columns are qualified with double quotes (") and also the lines end with Line Feed (
) with the date being the last column. The below screenshot was taken using Notepad++, which can display the special characters in a file. LF in the screenshot denotes Line Feed.
Created a simple table named dbo.Destination
in the SQL Server database to populate the CSV file data using SSIS package. Create script for the table is given below.
CREATE TABLE [dbo].[Destination](
[OrderNumber] [varchar](50) NULL,
[OrderDate] [date] NULL
) ON [PRIMARY]
GO
On the SSIS package, I created two connection managers. SQLServer was created using the OLE DB Connection to connect to the SQL Server database. FlatFile is a flat file connection manager.
Flat file connection manager was configured to read the CSV file and the settings are shown below. The red arrows indicate the changes made.
Provided a name to the flat file connection manager. Browsed to the location of the CSV file and selected the file path. Entered the double quote ("
) as the text qualifier. Changed the Header row delimiter from {CR}{LF} to {LF}
. This header row delimiter change also reflects on the Columns section.
No changes were made in the Columns section.
Changed the column name from Column0 to OrderNumber
.
Changed the column name from Column1 to OrderDate
and also changed the data type to date [DT_DATE]
Preview of the data within the flat file connection manager looks good.
On the Control Flow
tab of the SSIS package, placed a Data Flow Task
.
Within the Data Flow Task, placed a Flat File Source
and an OLE DB Destination
.
The Flat File Source
was configured to read the CSV file data using the FlatFile connection manager. Below three screenshots show how the flat file source component was configured.
The OLE DB Destination
component was configured to accept the data from Flat File Source and insert it into SQL Server database table named dbo.Destination
. Below three screenshots show how the OLE DB Destination component was configured.
Using the steps mentioned in the below 5 screenshots, I added a data viewer on the flow between the Flat File Source and OLE DB Destination.
Before running the package, I verified the initial data present in the table. It is currently empty because I created this using the script provided at the beginning of this post.
Executed the package and the package execution temporarily paused to display the data flowing from Flat File Source to OLE DB Destination in the data viewer. I clicked on the run button to proceed with the execution.
The package executed successfully.
Flat file source data was inserted successfully into the table dbo.Destination
.
Here is the layout of the table dbo.Destination. As you can see, the field OrderDate is of data type date and the package still continued to insert the data correctly.
This post even though is not a solution. Hopefully helps you to find out where the problem could be in your scenario.