none
Data-type conversion RRS feed

  • Question

  • I am having a table with 250 columns and 6571 rows in a .txt file

    I loaded this .txt into my database using SSIS

    But the problem is, the new table thus formed has all data-types converted to varchar(50)

    I need to get dates, currency, float, int etc but all i have is varchar(50)

    Can anyone give me an easy fix to this solution?

    And if type-casting is the solution, then what are the steps to do that?

    Monday, June 10, 2013 7:34 PM

Answers

  • In your flat file connection manager you need to go through and manually set all of the column types and sizes . (Advanced tab)

    Chuck Pedretti | Magenic – North Region | magenic.com



    • Edited by Chuck Pedretti Monday, June 10, 2013 7:43 PM
    • Marked as answer by DJ Rele Monday, June 10, 2013 8:01 PM
    Monday, June 10, 2013 7:41 PM
  • Or you can compare the file data with table data and for columns where there is discrepancy in data load, you have to change the data type. Since your column list is pretty big, I guess most of the columns will fit into varchar data type from file. But again for varchar data type, you would have to increase the length of some of the fields...otherwise truncations happen

    Thanks, hsbal

    • Marked as answer by DJ Rele Monday, June 10, 2013 8:01 PM
    Monday, June 10, 2013 7:50 PM

All replies

  • In your flat file connection manager you need to go through and manually set all of the column types and sizes . (Advanced tab)

    Chuck Pedretti | Magenic – North Region | magenic.com



    • Edited by Chuck Pedretti Monday, June 10, 2013 7:43 PM
    • Marked as answer by DJ Rele Monday, June 10, 2013 8:01 PM
    Monday, June 10, 2013 7:41 PM
  • Or you can compare the file data with table data and for columns where there is discrepancy in data load, you have to change the data type. Since your column list is pretty big, I guess most of the columns will fit into varchar data type from file. But again for varchar data type, you would have to increase the length of some of the fields...otherwise truncations happen

    Thanks, hsbal

    • Marked as answer by DJ Rele Monday, June 10, 2013 8:01 PM
    Monday, June 10, 2013 7:50 PM
  • You need to use data conversion task in ssis package to get your required result.

    Monday, June 10, 2013 8:06 PM