Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Posts
    28

    Unanswered: howto get avoid Bulk insert data conversion error?

    hi, i having a problem in bulk insert , which is regard the text file that
    to insert into database, when insertion processing,

    if my textfile have NULL value, it give me Bulk insert data conversion error

    for example in my text file c:\mytest.txt , it contains data NULL
    Code:
    123  studentname  NULL

    can we let bulk insert detect NULL value ?

    i have try on putting "KEEPNULLS" , but it doesn't help , caused some fields in table may in datetime type
    Code:
    BULK INSERT [mytable] FROM  c:\mytest.txt WITH (FIELDTERMINATOR = ''\t'', ROWTERMINATOR = ''\n'', KEEPNULLS )'
    thank you
    Last edited by nakata; 08-07-06 at 21:59.

  2. #2
    Join Date
    Nov 2004
    Posts
    128
    You didn't really supply the error, which may have been helpful. I'd first try to get it to work in DTS, and see what happens there.

  3. #3
    Join Date
    Jul 2006
    Posts
    28
    thanks for reply, cfr , but i still keen on solution on bulk insert

    how to your handler NULL value in text file when bulk insert ?

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Unfortunately you've only given us a fraction of the informaiton that we really need to help you solve your problem. Take a look at the FAQ entry on how you can help us to help you.

    I only see two choices. You can preprocess your text file (parsing and converting the NULL marker to an empty string). You can post process the file by first importing it into a scratch table, then using CASE statements to "tweak" the NULL values.

    There might be other choices, but without knowing exactly what you're trying to do, these are the best choices that I can offer.

    -PatP

  5. #5
    Join Date
    Jul 2006
    Posts
    28
    thanks for reply , i finally figure out make sure the text file no NULL value and it work now , thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •