Getting NULL value when Importing spread sht to sql table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cdavii
    New Member
    • Jan 2008
    • 1

    Getting NULL value when Importing spread sht to sql table

    Anyone have an idea why i get null values when i import data from a ms spread sheet in a sql tbl. The table elemet(Spread sheet) in question contains alpha numerics. The sql table is populated with "NULL" when the value is numeric only. Example: A-ASP21A1-- imports perfect
    6500012111-- results in "NULL" in the sql table element
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    This should be moved to the proper forum but not sure which one.

    Comment

    • kadghar
      Recognized Expert Top Contributor
      • Apr 2007
      • 1302

      #3
      Originally posted by drhowarddrfine
      This should be moved to the proper forum but not sure which one.
      Since its an MS spreadsheet, i would say he migth be using SQL Server as well.

      Comment

      • imtmub
        New Member
        • Nov 2006
        • 112

        #4
        Change the sql table field type to nvarchar.

        Use this statement to import from excel. I got the same kind of data and imported from excel.
        [CODE=SQL]Select * Into[dbo].[table]
        FROM OPENROWSET('Mic rosoft.Jet.OLED B.4.0',
        'Excel 8.0;Database=C: \Documents and Settings\admin\ Desktop\excel.x ls;IMEX=1',
        'SELECT * FROM [Sheet1$]')[/CODE]

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          Originally posted by cdavii
          Anyone have an idea why i get null values when i import data from a ms spread sheet in a sql tbl. The table elemet(Spread sheet) in question contains alpha numerics. The sql table is populated with "NULL" when the value is numeric only. Example: A-ASP21A1-- imports perfect
          6500012111-- results in "NULL" in the sql table element

          what's the data type of the target table?

          -- ck

          Comment

          • jhardman
            Recognized Expert Specialist
            • Jan 2007
            • 3405

            #6
            Originally posted by ck9663
            what's the data type of the target table?

            -- ck
            Are you just importing with SQL Server?

            Comment

            Working...