I’m trying to import a csv file into SQL using SSIS and am hitting a fundamental flaw.
SSIS seems to determine that all fields are varchar(50), even though it correctly identifies the comma delimiter.
This is causing issues when I try to send the data to my table in SQL.
Is there a way of making it recognise that a field of length 3 is actually a field of length 3, and not 50?
Thanks
Yes, there’s a Suggest Types function in the Flat File Connection Manager Editor.
Assume you have got a CSV file shown in the first image.
Create a new Flat file connection, and browse this file on your computer. The Columns tab shows the sample of the file.
Click Advanced tab. There you can see all columns have
DT_STRtype with the length of 50. What you can see is the Suggest Types… button. Click this.Set parameters as you like. Defaults are all right in my case. Click OK.
Now the first column has the type of
DT_STRwith the length of 1. (The other two columns have got new types as well. The Number column gotDT_I1(because we choosed the smallest appropriate integer type option), and the Date column gotDT_DATE.