Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Thursday, 12 June 2014

Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)

BULK INSERT TASK IN SSIS

Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”
August 13, 2009
[Bulk Insert Task] Error: An error occurred with the following error message: “Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”.The OLE DB provider “BULK” for linked server “(null)” reported an error. The provider did not give any information about the error.Bulk load: An unexpected end of file was encountered in the data file.”.


Solution:

Wrong setting of ColumnDelimiter= tab when actually it was ColumnDelimiter= comma.
You should choose ColumnDelimiter= comma [for bulk insert] as see below



Destionation TAble:

create table  Cricketerinfo(cid int,cname varchar(30),cposition varchar(30),cage int)

select * from Cricketerinfo

Source File:

1,sachin,opener,35
2,dravid,middle,32
3,ponting,middle,3
4,azhar,lower,36





That is it in SSIS

you can know in T-SQL to do same task as see below:

BULK INSERT dbo.Cricketerinfo 
FROM 'D:\SQL\My SSIS\Cricketerinfo.txt' 
WITH ( FIELDTERMINATOR =',', FIRSTROW = 2 )

Demo from web:

BULK INSERT Task used to copy the large amount data from text files to SQL Server Tables.
EX: You have one (1) million records of data present in your text (.txt) file and if you want to import into SQL Server Table, the easiest way to achieve this is by using BULK INSERT Task.
You can configure BULK INSERT Task Like Below:
1. Drag and drop BULK INSERT TASK from Toolbox to CONTROL FLOW
2.Double Click on Bulk Insert Task to open task editor  . After Opening your Task should look like this
3. Click on “Connections” from the left side menu and choose your SQL DATABASE and Related TABLE By configuring OLEDB Connection Manger.
4. Select “source file” connection path under “source” option.
5. click on the “options” in the left tab of the editor, and select Starting row(First row). Also specify actions to perform on the destinations table or view when the task inserts the data.
6. At last run the package and your source(.txt) data will copy into Destination (SQL Server Table).
Bulk Insert task is easy to use and configure. But it has some limitations. They are:
1.It only allows to append the data into  the table  and you cannot perform truncate and
load.
2. Only FaltFile can be used as source and not any other types
3. Only SQL Server Databases Can be used as destination. It doesn’t Support any other
Files/RDBS Systems.
4. A  failure in the Bulk insert task does not automatically load back successfully loaded
batches
5. only members of SYSADMIN fixed server role can run a package that contains Bulk.