473,383 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Issue when reading data from excel sheet

ammoos
100 100+
Hi Friends

I am getting the following error when I am trying to read data from an excel sheet using sql script

OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].


If I save the excel file in the database server machine, then it will work fine.. I am getting this error message when I save the excel file in any other machine in the network and trying to read data from that excel sheet

I am using the following code

Select @PowerFileName = '\\xxx.xxx.x.xxx\upload\Data_Sheet.xls'
EXEC MASTER..XP_CMDSHELL @cmd, NO_OUTPUT
set @provider = 'Microsoft.Jet.OLEDB.4.0'
set @ExcelString = 'Excel 5.0;Database=' + @PowerFileName
EXEC ('select * into tbl_BaseLoad from OPENrowset(''' + @provider + ''',''' + @ExcelString + ''',''SELECT * FROM [baseload$] WHERE F3 IS NOT NULL UNION SELECT * FROM [baseload$] WHERE F2='+ @CurrentDateNumber +''')')


Please help me

Ammooss
Jun 26 '09 #1
8 3371
ck9663
2,878 Expert 2GB
Can you access that machine from the SQL Server?

-- CK
Jun 26 '09 #2
ammoos
100 100+
Yes.. I can access that machine from sql server machine
Jun 29 '09 #3
ck9663
2,878 Expert 2GB
How do you access the remote machine?

-- CK
Jun 30 '09 #4
ammoos
100 100+
Sorry..I couldnt understand your question.. I access the remote machine using the IP via the Run
Jun 30 '09 #5
ck9663
2,878 Expert 2GB
I mean accessing inside the SQL Server. The RUN command is on the OS level, not inside SQL Server. Have you tried accessing the remote machine from SQL Server via IP?

--- CK
Jun 30 '09 #6
ammoos
100 100+
CK

I am not sure how to access the remote machine from SQL Server via IP.. Can you pls help me?

Ammooss
Jul 1 '09 #7
ammoos
100 100+
CK

I just tried to copy the same excel file from remote machine to the server machine using the following code.. but that time I got the message "Access is denied"

declare @msg varchar(3000)
declare @file varchar(1000)
declare @file1 varchar(1000)

set @file = '\\remote macine IP\folder\Data_Sheet.xls'
set @file1 = '\\server machine IP\folder\Data_Sheet1.xls'

SET @msg = 'copy "' + @file + '" "' + @file1 + '"';

exec master.dbo.xp_cmdshell @msg

but this code works fine if I try to copy a file from one folder in the server machine to another folder

Ammooss
Jul 1 '09 #8
ck9663
2,878 Expert 2GB
Here, read this first.

Good luck!

--- CK
Jul 1 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
3
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown....
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
4
by: preetinair033 | last post by:
Hi All, I have written a program to write the data into excel file (for eg: file.xls). This writes the data into the active sheet, ie, the sheet1. However I wish to write and read data from an...
1
by: =?Utf-8?B?ZmhpbGxpcG8=?= | last post by:
We have a code snippet that downloads data to Excel. it is writing row by row. This causes a performance issue. Any ideas on how to speed this up will be appreciated. Please find below an...
1
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= | last post by:
Hello All, I am trying to read an Excel spreadsheet (xls) programmatically. I have used the ODBC database route and have opened the Excel spreadsheet and then using a 'CRecordset', I read each...
1
by: vtangella | last post by:
Hi Guys! Here i am using Apache POI for reading the Excel sheet in java and then i am capturing the excel sheet data into a ArrayList and then i am storing it in DB. Any Other way to store...
4
ammoos
by: ammoos | last post by:
Hi Friends, I need to read data from an excel sheet. I am keeping this excel sheet in a remote machine. I am using OLEDB connection to read the data from this excel sheet. But when I am trying to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.