Loading tables from text files

  • I want to import 80 tables into a database. I'm using the Import and Export Data(32-bit) utility. They are all text files, arranged by columns and should be compatible with the tables I have created. For the data source, I am using "Flat File" source - is this correct?

    Also, the tables are already created in the database, but some of the fields are not mapping correctly - it seems to be using a generic "varchar" format for each field.

    Can I force it to use the existing empty table structure I have created?

    Tom

  • hi,

    You have created table strucutre into SQL server and want to import data from a flat file ok?

    If yes Import wizard shpuld work, use all task--> Import data, select source flat file

    Ali
    MCTS SQL Server2k8

  • Yes, it's failing on some records though. It is not using the structure I set up in the database - it is trying to impose its own structure, where every field is set to varchar(50).

  • I believe you can set the types during the running of the wizard steps.

    If the files are text files with no headers then you could possible concatenate them all into a single file prior to import.

    If you are only importing the once, then the implicit conversions may be acceptable.

    For greater control (if you are running this regularly) an SSIS routine (which loops through the source files) would take care of this.

    ---------------------------------------------
    If data can screw you, it will; never assume the data are correct.

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

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