Transfer of data from SQL to excel and vice versa
Posted on 2004-08-28
Hope you all are doing fine I have got some difficulty in doing something which I am doing the first time. I have a program writeen in Vb.net in which backend is SQL. The scenario is like that from this program I have to take some data and update the data on another computer and both of these computers cannot be connected to one another. So I thought it is best to export the data into excel and again import the data from excel to SQL. But I am not able to do that I got some code from the net but it is not working.
What I want to do is that I want to create a small application which will use SQL only to export the data ? I am using below mentioned code but it is giving some error.
CREATE PROCEDURE export_data AS
Insert into #temp select Reqdate from Requests where Reqdate = '2004/08/26'
insert into OpenRowset('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=c:\Student.xls; HDR=No', [StudentData])
select ReqDate from #temp
This gives an error that either the table StudentData does not exist or you do not have the permission to write on that.
Anybody can help me out.