Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Location
    Denmark
    Posts
    7

    Unanswered: import and text qualifier

    Hi

    How can I import txt files, in which data sometimes can contain
    the letter that is used as text qualifier

    Example txt file: 'abc',123, 'john's',12

    Here the word -john's- contains the same letter as the text qualifier I have to use.

    Can it be true, that this can't be done i MS SQL, when it can be done in MS Excel, Paradox etc..

    Regards
    Carsten H.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    When you need to import a delimter character like the apostrophe in Transact-SQL, all computer languages need some kind of escape character to prefix the delimiter. In C or C++, you often use the backslash (\} for an escape character.

    This is done automagically for you when using the text file import utilities like BCP, and manually when using Transact-SQL syntax. What tool are you using?

    -PatP

  3. #3
    Join Date
    Oct 2003
    Location
    Denmark
    Posts
    7
    Weel, I'm not an expert at sql, so I'm using DTS and I have tried different kind of stuff using BULK INSERT

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    To make the process a lot more simple, just import the text file into an Excel spreadsheet, then use DTS to import it into SQL Server from the spreadsheet's XLS file.

    There are certainly ways that it can be done using just the SQL tools, but it sounds like you are a lot more comfortable using Excel, so that is probably the best route for you.

    -PatP

  5. #5
    Join Date
    Oct 2003
    Location
    Denmark
    Posts
    7
    HATE Excel

    So the answer must be, that I still have to use sql in MySql, and then throw it all back to my main db (MS SQL)

Posting Permissions

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