DTS job - loading data from CSV file

  • Guys,

    I relatively new to sql server 2005, I am trying to create a job which grabs csv file from a location c:\data and loads it into a table. This job should run every night. How can I set it up so that field is mapped to the value in the csv file.

    Any input/suggestions would help

    Thanks

  • Hi,

     

    1.Add a data flow task.

    2.In data flow,select flat file source

    3.Give a name for connection manager.

    4.Click on browse,select the file file c:\data,

    5.Select the checkbox if the csv has column names as headers

    6.Click on preview check if column have been mapped.

    7.Select OLEDB destination.select the table in which you have to load.

    8.Execute the job

    Regards

    Usha

  • You may be able to use something like the the following, too.

     

    BULK INSERT  NorthWind.dbo.[table_name]

       FROM 'C:\InputFile.csv'

        WITH (FieldTerminator = ',',

       FirstRow = 2)  -- Use if csv file has column names

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

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