Importing CSV Flat File - how can we change defaults of all columns to n characters



  • I have to import a CSV file into a table that has 75 columns. The Flat File connection defaults all the columns to 50 character strings. Some of the fields are much smaller and some are 255. The only solution I've found so far to match the Flat File connection columns to the schema of the table is to manually update each column in the connection and then again in the Flat File Data Source in the Data Flow.

    There has to be a better way.



  • The .dtsx file is XML and you can edit it directly. Just right-click the .dtsx and select "View Code". Then you can bulk edit or search and replace the values. eg

    enter image description here

    You can also have the Flat File source sample your data to suggest types, including adding padding to string columns.

    enter image description here




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2