Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Problem while importing data to Microsoft Sql Server 2005 from .csv file

Problem while importing data to Microsoft Sql Server 2005 from .csv file

Scheduled Pinned Locked Moved Database
helpdatabasesql-serversysadmin
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    a_b111
    wrote on last edited by
    #1

    I want to import data to Microsoft Sql Server 2005 from .csv file In .csv file I am having a column which has numeric data . During the import process I am receiving data conversion error. In case I used this column as string then it works, but I want column as numeric. Kindly tell if I am missing something. Thanks in Advanced.

    A M D 3 Replies Last reply
    0
    • A a_b111

      I want to import data to Microsoft Sql Server 2005 from .csv file In .csv file I am having a column which has numeric data . During the import process I am receiving data conversion error. In case I used this column as string then it works, but I want column as numeric. Kindly tell if I am missing something. Thanks in Advanced.

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      a_b111 wrote:

      which has numeric data . During the import process I am receiving data conversion error

      Either you have a non-numeric value, or your numeric data type does not match that of your file. Check all your values against your data types.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • A a_b111

        I want to import data to Microsoft Sql Server 2005 from .csv file In .csv file I am having a column which has numeric data . During the import process I am receiving data conversion error. In case I used this column as string then it works, but I want column as numeric. Kindly tell if I am missing something. Thanks in Advanced.

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        As Bob said - data types, probably a blank cell that is treated as "". I always import into a staging table of varchars and use a stored proc to do the transforms AFTER loading the data. Dates will also screw you with weird formats.

        Never underestimate the power of human stupidity RAH

        A 1 Reply Last reply
        0
        • M Mycroft Holmes

          As Bob said - data types, probably a blank cell that is treated as "". I always import into a staging table of varchars and use a stored proc to do the transforms AFTER loading the data. Dates will also screw you with weird formats.

          Never underestimate the power of human stupidity RAH

          A Offline
          A Offline
          a_b111
          wrote on last edited by
          #4

          I have tried to import into a staging table of varchar and use a query to do the transforms AFTER loading the data, but it failed. Please tell me the stored procedure to do the transforms AFTER loading the data.

          M 1 Reply Last reply
          0
          • A a_b111

            I have tried to import into a staging table of varchar and use a query to do the transforms AFTER loading the data, but it failed. Please tell me the stored procedure to do the transforms AFTER loading the data.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            a_b111 wrote:

            Please tell me the stored procedure to do the transforms AFTER loading the data.

            You have to write it, in your OP you said you could get it to work using string - varchar so that part should work. Now you have the data in front of you and you know where it has to go - so write the procedure to do the work. This removes the LOAD from the potential problems you can have, now all you need to do is transform the data into your tables.

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            • A a_b111

              I want to import data to Microsoft Sql Server 2005 from .csv file In .csv file I am having a column which has numeric data . During the import process I am receiving data conversion error. In case I used this column as string then it works, but I want column as numeric. Kindly tell if I am missing something. Thanks in Advanced.

              D Offline
              D Offline
              dojohansen
              wrote on last edited by
              #6

              a_b111 wrote:

              Kindly tell if I am missing something.

              Yes. :cool:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups