Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    20

    Unanswered: Import multiple txt files

    I have 8GB of text files which are basically log files from the past few years.
    There is 24 text files per directory which are labeled for every day (so they are not all in 1 folder).
    It would make reading them much easier if I could import them to SQL but I only seem to be able to import 1 at a time? (with the wizards )

    Surely there is a way to mass import without all the costly applications that google searches give me?
    cheers :P

  2. #2
    Join Date
    Jul 2005
    Location
    New Zealand
    Posts
    61

    Use DTS

    Use a DTS package implementing looping constructs with ActiveX scripts to loop through each folder and import the data contained in each file. There are some basic examples of how to do this on SQLDTS.com

    Regards
    Lempster

  3. #3
    Join Date
    May 2007
    Posts
    49
    If you are using SQL Server 2005 then you can use Integration service.
    SSIS provides number of features to perform variety of tasks. You can use for loop container to import multiple text files at a time.
    Mihir Mehendale
    DB Team @ Clarion
    Clarion Technologies
    (SEI CMMI Level 3)
    Pune, India
    www.clariontechnologies.co.in
    www.vEmployee.com

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    I would use bcp and a cmd shell script for this.

  5. #5
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by jezemine
    I would use bcp and a cmd shell script for this.
    I would probably wrap a DTSRun in a cmd shell script (with a for/do) and pass in whatever needed input variables (date, basefilename, etc.), I just wish cmd had good "native" equivalents of grep and sed that exist in UNIX. I've used type | find, type | findstr but it gets a bit clumsy.

  6. #6
    Join Date
    Apr 2007
    Posts
    20
    Lost of ideas for me to look at here hehe, thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •