Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 BULK INSERT, bulk copy

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-11-29 : 08:27:08
Linanga writes "I am trying to use the BULK INSERT and/or bulk copy utility and fails. In Oracle, they have the LOAD DATA utility and works very fine. I am using both Oracle and SQL.

I have tried to use the FORMATFILE, the command prompt, have tried reading my data from excel, text as well as csv files but to no avail.

Everytime I try to insert data using BULK INSERT the following error occurs:

Server: Msg 4832, Level 16, State 1, Line 1
Bulk Insert: Unexpected end-of-file (EOF) encountered in data file.
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'STREAM' IRowset::GetNextRows returned 0x80004005: The provider did not give any information about the error.].
The statement has been terminated.

When I try using the command prompt, only about 8 out of forty records are inserted and wrongly.

I have also tried using DTS to import the data but it seems nothing is working with SQL.

Please assist."

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2004-11-30 : 04:02:18
Hi, try this


bulk insert Table from 'Path of text file'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
TABLOCK
)

Make sure that the data in the text file are seperated by comma.

Madhivanan
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-30 : 05:03:18
It's worth working with small files to start off with and building from there until you understand the concepts.
Try it with subsets of your file.
see
http://www.nigelrivett.net/BCP_quoted_CSV_Format_file.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -