BULK INSERT not inserting string with 'D'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clarkie342
    New Member
    • Jan 2009
    • 3

    BULK INSERT not inserting string with 'D'

    I am using BULK INSERT to load one of my files into the database. I noticed that values like 5D08, 08D038 is getting converted to numeric values like 500000000 and 8E+38 resp even though the field in the database is varchar. Has anybody seen this before? How can I prevent this?
    Thanks.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Do you use FMT file?

    -- CK

    Comment

    • clarkie342
      New Member
      • Jan 2009
      • 3

      #3
      No. Can I specify the field type in the format file?

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Yes. But that did not really answer your question :)

        Is it possible to post here the structure of your target table and your BULK INSERT statement?

        -- CK

        Comment

        • clarkie342
          New Member
          • Jan 2009
          • 3

          #5
          My bad - its actually sqlbulkcopy class that I am using, though functionally it is the same as bulk insert.
          Here is my connection string
          Provider=Micros oft.Jet.OLEDB.4 .0;Data Source='C:\temp \temp.csv';Exte nded Properties='tex t;HDR=No;FMT=De limited'

          lets say this is my target table, Column C and Column H are the ones thats causing the issue.

          [A] varchar(30),
          [B] varchar(90),
          [C] varchar(25),
          [D] datetime,
          [E] varchar(10),
          [F] varchar(25),
          [G] varchar(10),
          [H] varchar(25),
          [I] float,
          [J] varchar(25),
          [K] varchar(25),
          [L] varchar(10),
          [M] datetime,
          [M] datetime,

          I am considering using schema.ini now but would like to know if there is another option. Thanks.

          Comment

          • ck9663
            Recognized Expert Specialist
            • Jun 2007
            • 2878

            #6
            Check your file. There could be a delimiter within one of the data on the left. Also, can't you use BULK INSERT? CSV are just ordinary text, you can use BULK INSERT to import the file.


            -- CK

            Comment

            Working...