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 2005 Forums
 Transact-SQL (2005)
 Microsoft.Jet.OLEDB.4.0" for linked server "(null)

Author  Topic 

ricky_1605
Starting Member

30 Posts

Posted - 2011-11-08 : 00:57:36
Hey guys

I made this query:
UPDATE T1 SET t1.PS_No = t2.PERNR, t1.Name = t2.FNAME, t1.Sex = t2.Gender, t1.Birthdate = t2.DOB, t1.Grade = t2.GRADE_TEXT, t1.Department = t2.ORG_UNIT, t1.Unit = t2.PA_CODE, t1.Location = T2.PSA_TEXT, t1.Email = t2.EMAIL_ID, t1.Mobile = t2.MOBILE, t1.DateOfJoining = t2.DOJ, t1.Dept_Code = t2.CC_CODE, t1.Dept_Head_PSNo = t2.DH_PSNO, t1.Dept_Head_Name = t2.DH_ENAME
FROM Employee1 t1
JOIN (SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\20111103_HR_HMD.xls;HDR=YES',
'SELECT * FROM [20111103_HR_HMD$]')) t2
ON t1.PS_No = t2.PERNR


INSERT INTO Employee1 (PS_No, Name, Sex, Birthdate, Grade, Department, Unit, Location, Email, Mobile, DateOfJoining, Dept_Code, Dept_Head_PSNo, Dept_Head_Name, User_Code, Username, Password)
SELECT t2.PERNR, t2.FNAME, t2.Gender, t2.DOB, t2.GRADE_TEXT, t2.ORG_UNIT, t2.PA_CODE, T2.PSA_TEXT, t2.EMAIL_ID, t2.MOBILE, t2.DOJ, t2.CC_CODE, t2.DH_PSNO, t2.DH_ENAME , 'User', t2.PERNR, t2.PERNR
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\20111103_HR_HMD.xls;HDR=YES',
'SELECT * FROM [20111103_HR_HMD$]') t2
WHERE t2.PERNR NOT IN (SELECT PS_No FROM Employee1 t1)

now when i execute it, it gives an error:

Msg 7399, Level 16, State 1, Line 10
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7303, Level 16, State 1, Line 10
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

Please help. This query used to run fine earlier.

Nipun Chawla

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-08 : 02:18:52
is the excel kept open by someone?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ricky_1605
Starting Member

30 Posts

Posted - 2011-11-08 : 03:07:16
no the excel is not open.

Nipun Chawla
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-08 : 03:21:11
ok. is D:\20111103_HR_HMD.xls local path or path in the server?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ricky_1605
Starting Member

30 Posts

Posted - 2011-11-08 : 03:42:23
This is the local path and sql server is also installed on this PC only.

Nipun Chawla
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-08 : 04:24:46
also is sheet name same as excel filename?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ricky_1605
Starting Member

30 Posts

Posted - 2011-11-08 : 04:30:39
yes it is same as excel filename

Nipun Chawla
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-08 : 06:58:54
see this to

http://connect.microsoft.com/SQLServer/feedback/details/284113/import-excel-data-with-openrowset-on-production-server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -