locked
Why can't I get excel to import into SQL? RRS feed

  • Question

  • Hi all, 

    I'm trying to import data from an excel spreadsheet into SQL server. The original excel sheet has 2 columns. One containing an ID number with 7 positions. The second, a long text description for that product. The descriptions vary in length from 100 characters up to nearly 2000. When using the import wizard I am choosing 'edit mappings' and going in to set the length for the description column for 2000.

    In addition, I've gone through the original spreadsheet and replaced all of the following characters:

    ' to ''

    & to and

    % to percent

    + to plus

    # to number

    / to - 

    Despite all of this precautions, I continue to receive the following errors: 

    0xc020901c

    0xc020902a

    0xc0047038

    What else do I need to do here to get this thing into SQL? 

    Monday, September 10, 2012 2:58 PM

Answers

  • You may be having a problem with Excel's selection of data type for that column.  If the first eight rows of descriptions are all smaller than 255 characters, Excel will select a "text" data type.  When it encounters a cell with more than 255 characters, it will truncate it.

    If you can alter the "TypeGuessRows" entry in the registry (there may be more than one) to be zero, that may solve your issue.


    Todd McDermid's Blog Talk to me now on

    • Proposed as answer by COZYROC Tuesday, September 11, 2012 5:49 PM
    • Marked as answer by Eileen Zhao Monday, September 17, 2012 5:25 AM
    Monday, September 10, 2012 10:08 PM

All replies

  • It is really hard to see the image, I suggest to copy and paste them here.

    But the next thing to check is the use of the proper datatypes.


    Arthur My Blog

    Monday, September 10, 2012 3:05 PM
  • Re-run the import, but this time do not do edit mappings and try to set the column length. Let SQL auto create the database table for you with the right length. Clearly you have some text in your excel file which has a lenght greater than 2k which causes the truncation issue.

    http://btsbee.wordpress.com/

    Monday, September 10, 2012 3:10 PM
  • You are facing issue of trauncation. Try to set size more than 2000, may be data is coming into unicode form that take double space.

    Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!


    • Edited by RohitGarg Monday, September 10, 2012 6:29 PM
    Monday, September 10, 2012 6:29 PM
  • you can also configure ERROR OUTPUT and redirect them to a flat file destination to troubleshoot the problem and implement a solution for that

    http://www.rad.pasfu.com

    Monday, September 10, 2012 8:44 PM
  • You may be having a problem with Excel's selection of data type for that column.  If the first eight rows of descriptions are all smaller than 255 characters, Excel will select a "text" data type.  When it encounters a cell with more than 255 characters, it will truncate it.

    If you can alter the "TypeGuessRows" entry in the registry (there may be more than one) to be zero, that may solve your issue.


    Todd McDermid's Blog Talk to me now on

    • Proposed as answer by COZYROC Tuesday, September 11, 2012 5:49 PM
    • Marked as answer by Eileen Zhao Monday, September 17, 2012 5:25 AM
    Monday, September 10, 2012 10:08 PM