CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Oct 2006
    Posts
    65

    Bulk Insert problem

    Hi DB Gurus,

    I am using SQL server 2000 and VB6 for my project. In its one module I have to import a raw data from a text file having row terminator = \n and field terminator = TAB. I am using following SQL to import data.

    Code:
    BULK INSERT billing_master.dbo.test 
    FROM 'c:\abc.dat'                         --Raw data source file
    WITH (FIELDTERMINATOR = '\t',ROWTERMINATOR = '\n', FIRE_TRIGGERS)
    The problem is in raw data source file. There is an extra "ENTER/Line Break" at the end of last row of data. Means last row contains 2 x \n.
    Due to this my above SQL enable to import data into DB. But when I manually delete last one "ENTER/Line Break" (by oppeing file in notepad and removing it), my query works fine.

    Can anyone give me a solution either in SQL or in VB6, also the attached image explain the my questions graphically.

    Thanks in advance.

    Umar
    Attached Images Attached Images

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured