Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    57

    Unanswered: Text File Import

    Quick advice question. I import lots of text files -- many with 50 plus data columns. Few come with a table layout other than perhaps the first row having a set of column names.

    When I go to pull them into SQL server the columns default to varchar 8000. Is anyone aware of a tool (as a part of SQL Server or otherwise) that can scan a column of data and recommend a data type and size.

    Appreciate any recommendations.

    Ray

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    If the columns are fixed width, then I'd recommend using Excel. It does a good job of making educated guesses about columns, and gives you a simple GUI to adjust when it guesses incorrectly.

    If the columns are delimited, I'd suggest Perl or something like it.

    -PatP

  3. #3
    Join Date
    Jun 2004
    Posts
    57
    Pat.
    Thanks. Actually i use excel for files with fewer than 65,000 records. Access also has a 'wizard' that helps (it will even give you the SQL to create the table).

    Sounds like i've taken it about as far as anyone else has.

    Although, I've never worked with Perl so that's a new one...

    Ray

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This is just an odd thought, but would the DTS Wizard do what you want? It isn't quite as "pretty" as Excel, and when it blows a guess, it blows it sky-high, but it isn't bad for most purposes.

    If it won't do (especially when you are importing gazillions of files at once), then I'd go with an "idiot-simple" scripting language. That would be the simple solution for "industrial strength" usage, I'd think.

    -PatP

Posting Permissions

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