BCP Bulk insert from an excel file

  • Hi,

    Is it possible to bulk insert from an excel file (after converting it into a txt file).

    I tried it but could not succeed, can anyone suggest some way for it

  • what is the error message you were getting, please give more info


    Everything you can imagine is real.

  • I have used the following syntax

    bulk insert Ionia_ISmSv2_Office.dbo.tblJobsspare from 'c:\Scrap.xls'

    with (DATAFILETYPE = 'char', fieldterminator = '\t',

    rowterminator = '\n')

    And then received the following error:

    Server: Msg 4863, Level 16, State 1, Line 1

    Bulk insert data conversion error (truncation) for row 1, column 2 (Job Title).

    Server: Msg 4863, Level 16, State 1, Line 1

    Bulk insert data conversion error (truncation) for row 2, column 1 (Name).

  • Can you supply the first few rows from the file and the ddl for the destination table?  Your BCp statement still references a .xls file - is this the original file or the converted text version?

    Also, If you have got column names in your text file then you will need to skip the first row.

     

    J

  • Bulk insert data conversion error (truncation) for row 1, column 2 (Job Title).
    Bulk insert data conversion error (truncation) for row 2, column 1 (Name). 

    Some of the data in your spreadsheet is longer than the fields you are trying to import them into. Specifically, look at how you have the Job Title and Name fields declared in your table. Modify them to allow enough characters to accept the longest Job Title or Name that you have in your spreadsheet.

Viewing 5 posts - 1 through 4 (of 4 total)

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