How to load fixed length format file to sql server table using SSIS

  • Hi,

    I have the below table struc in SQL server 2008

    IDChar10

    D_DATEDate10

    STATUSChar1

    S_NUMChar16

    K_AMTNumeric16

    N_NUMChar30

    B_NUMChar1

    R_IChar1

    I_NUMChar30

    C_DTdate8

    Need to load the flat file source into the above table.

    Can you please suggest how to load?\

    Rows in flat file are as follows

    010T11003219920120605 S0000020224 52.26 QS2011201206031 1OT1100321990000002006

    Regards

    SqlStud

  • It is Fixed length Format.

    There are no delimiters in the file so when one field ends, the other starts without any tabs, comma(s), or spaces between them. Whitespace fills in where there is no data to maintain the field length. There are no null characters, only whitespace.

    Regsards

    SqlStud

  • SSIS allows you to define fixed format inputs. Had to do this with DTS (SQL Server 7/2000) packages at a previous employer many years ago.

  • Can anyone please reply on this.?

    I need to complete the task today

    Regards

    SqlStud

  • Did you tried Google? I cannot imagine that typing in "ssis import file fixed length" wouldn't give any meaningful result.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi,

    Is it possible or need to follow the other way ie creating SP etc

    Regards

    Sivakkolundu

  • sqlstud (6/11/2012)


    Hi,

    Is it possible or need to follow the other way ie creating SP etc

    Regards

    Sivakkolundu

    It's very very easy in SSIS. Just create a flat file connection manager and explore the options.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi

    As already said

    It is Fixed length Format.

    There are no delimiters in the file so when one field ends, the other starts without any tabs, comma(s), or spaces between them. Whitespace fills in where there is no data to maintain the field length. There are no null characters, only whitespace.

    No headers in the source file

    Please suggest

    Regards

    SqlStud

  • sqlstud (6/11/2012)


    Hi

    As already said

    It is Fixed length Format.

    There are no delimiters in the file so when one field ends, the other starts without any tabs, comma(s), or spaces between them. Whitespace fills in where there is no data to maintain the field length. There are no null characters, only whitespace.

    No headers in the source file

    Yes, and...?

    All you just said can be configured in the flat file connection manager. Have you even looked at it?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi from flat file fixed length data we can store into table using ssis but the length of source u given is 78 and in the data types which u declared

    total length was 128 and K_amt has declared as numeric 16 according to source '26 QS2011201206031' it wil come this value but data type is numeric

    here it will come varchar according to data . 🙂

  • Thanks to all

  • Hi ,

    You can use script componet and write the c# or vb script as per requirements

  • sqlserver8650 (6/12/2012)


    Hi ,

    You can use script componet and write the c# or vb script as per requirements

    Why would I use a script component when I can define each column of the fixed width formatted file in the flat file connector and map those columns directly to the appropriate columns of the destination table?

  • Lynn Pettis (6/12/2012)


    sqlserver8650 (6/12/2012)


    Hi ,

    You can use script componet and write the c# or vb script as per requirements

    Why would I use a script component when I can define each column of the fixed width formatted file in the flat file connector and map those columns directly to the appropriate columns of the destination table?

    Because you can, that's why.

    :hehe:

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (6/12/2012)


    Lynn Pettis (6/12/2012)


    sqlserver8650 (6/12/2012)


    Hi ,

    You can use script componet and write the c# or vb script as per requirements

    Why would I use a script component when I can define each column of the fixed width formatted file in the flat file connector and map those columns directly to the appropriate columns of the destination table?

    Because you can, that's why.

    :hehe:

    True, but why the extra complexity? :w00t:

Viewing 15 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic. Login to reply