BCP Excel with Null value into table

  • I have an excel spreadsheet, one of the column (COLUMNA) can be blank (null) or can have values.  The first 8 rows that column was blank.  Then after that it had value in the 9th rows.  I bcped the excel spreadsheet to a table.   After the bcp finished, I found out that the column in the table that corresponding to the COLUMNA in the spreadsheet was null in the whole table.  Can anyone know why? 

     

  • This is a rather obscure problem that pops up here frequently.  Check my comment under the discussion of the QOD on March 15, 2006. < http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=120&messageid=265749 >.

    As I mentioned in the discussion, this is documented on this MS KB article: "PRB: Excel Values Returned as NULL Using DAO OpenRecordset" at http://support.microsoft.com/kb/194124/EN-US/.  This has been an issue since at least Excel 97 and VB4 (and may be longer than that). But it can be worked around by treating all columns as text.  See these links for the details how to do this.

    Hope this helps



    Mark

  • DTS plays a guessing game with excel. It looks at the first 8 rows of data and then decides itaself what data type the column is and whether it expects nulls everywhere.

    This will fix your problem.

    http://www.sqldts.com/default.aspx?254


    ------------------------------
    The Users are always right - when I'm not wrong!

Viewing 3 posts - 1 through 2 (of 2 total)

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