Sunday, February 19, 2012

Bulk Copy Terror

Hi there,

I'm in dire need for a solution to a "Bulk Insert" problem.

Environmental: SQL 7
The unc path used is a shared folder on the local machine with full rights.

This is the SQL Table:

CREATE TABLE [dbo].[ArgiefTransaksies] (
[TakDepotKodeRef] [char] (4) NULL ,
[HoofraamNommer] [varchar] (2) NULL ,
[Dokumentnommer] [decimal](2, 0) NULL ,
[DataLyn] [varchar] (133) NULL)

Here is the file that I try to upload, TESTFILE.PRN

RZGB|FT|12| |\n
RZGB|FT|12| |\n
RZGB|FT|12| |\n
RZGB|FT|12| |\n
RZGB|FT|12|This is a test|\n
RZGB|FT|12| |\n
RZGB|FT|12|Zone 1 Zone 2|\n
RZGB|FT|12|Hello World||\n
RZGB|FT|12| 5 leading spaces|\n
RZGB|FT|12| Tab(10) - Hello|\n

Here is the SQL statement that I try to use:

Exec sp_dboption 'VKBTakDev', 'select into/bulkcopy', 'TRUE'

BULK INSERT ArgiefTransaksies
FROM '\\HKDATA060XP\Public\TESTFILE.PRN'
WITH
(
DATAFILETYPE = 'char',
FIELDTERMINATOR = '|',
ROWTERMINATOR = '|\n',
MAXERRORS = 0,
CODEPAGE = 'raw'
)

Here is the error that I keep getting...

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.
The statement has been terminated.

Regardshttp://support.microsoft.com/default.aspx?scid=kb;en-us;q324122 to workaround the issue.|||Have you tried BCP? See what happens when you go through the BCP wizard and create a format file. If it succeeds try to use it in BULK INSERT.

No comments:

Post a Comment