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 2000 Forums
 SQL Server Development (2000)
 Save ouput of Stored Procedure to excel file

Author  Topic 

NehaSharma
Starting Member

2 Posts

Posted - 2013-07-25 : 00:17:33
Good Morning,
I am trying to save the output of a stored procedure in excel file, i am using following code

INSERT INTO
OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=d:\book1.xls;Extended Properties=Excel 8.0;')...[Sheet1$]
exec rptworkorderstatus2 ''

but i am getting this error :
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" does not contain the table "Sheet1$". The table either does not exist or the current user does not have permissions on that table.

Plz Correct me,thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-25 : 00:45:48
is excel file in use? do you've access to the path?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-07-25 : 01:50:29
Check the file exists and and you have privileges.
A different method to export from SQL Server is to use Powershell , which does give you a fair bit of control - http://www.sqlserver-dba.com/2013/05/sql-server-export-to-excel-with-powershell.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -