Reading a text file and importing to database

  • Hi,

    I am new to SSIS have a question regarding reading text file and importing to sql server 2005 database.

    Is it necessary for my text file to have column name on it or have a delimiter.Suppose I have a text file with no column delimiter but a document defines that first 10 characters are id ,next 5 are name etc etc.....

    How do I import such a text file into my database or is it always necessary for the text file to have a column delimiter or a column name?

    I am confused asto how to map the records with the table column?

    Please help?

  • In the file connection manager ..once you select the file where you want to extract.Then you have option as set the delimiter as fixed length.so your data in file should be fixed length between column level.Then you can choose 1st row as acolumn...if you dont have any column name.Then SSIS will take the column as column1,column2 etc..

    Next you need to map those column to respective columns in the table...So its not necessary that your flat file must have the column name..

  • Thanks for the reply, it helps.

    It implies that I will be able to set or map field length from my text file to columns in database.for example

    First 2 chars from file for coulmn id

    next 4 from file to column first name

    next 8 from file to column lastname

    Also the data in file is continous with no delimiters or space -

    example file data

    01Tom Harry

    02JackJill

Viewing 3 posts - 1 through 2 (of 2 total)

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