SQL Server SSIS - Flat File Import to Staging Table
Posted on 2010-08-24
I am importing a flat file source (csv) to a staging table, the flat file contains about 50 rows, and about 4gb of data.
Now, when I first define my flat file source, in the connection manager every row is defined a DataType of string [DT_STR] with a length of 50.
Is it suggested to use the "Suggest Type" button to have SQL define my rows or manually define them? Then, apply the same design to my staging table rows?
What is happening if I do use suggest type, then going straight to my database, I left SQL create the db, I get the following error:
Error: 0xC02020A1 at Stage Sales Extract, Flat File Source : Data conversion failed. The data conversion for column "COMMODITY" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
The COMMODITY row in the CSV file is defined as eight-byte signed integer [DT_I8], and in the staging table it is defined as "bigint".
When I say I let SQL create the table, in the OLE DB Destination, when I click it I have the option to select a "New" table, and the code is predefined for me with the data types and lengths.
Should I be manually defining my Data Types from the CSV to the staging?
If so, anyone have an example of the data types that I should be assigning to my rows based on the data in there and the finally in the staging table design?
New to SSIS/SQL, this was a project thrown at me and I am trying to get through this.
If I use [DT_STR] when defining my CSV Data Type (this is numbers and characters?), this should be set as varchar(lenght) in the table design?
Thank you for your help.