Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error,while inserting data into Excel from sql server 2005!!!!!! Expand / Collapse
Author
Message
Posted Friday, November 28, 2008 12:42 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 2:36 AM
Points: 2,840, Visits: 3,970
hi

i m trynig to insert data from sql server 2005 into excel 2003 but copuldn't

please find below query,error occurred and linked server settings

------------------------------------------------------------------------------------------
--Query
INSERT INTO OPENROWSET
('MICROSOFT.JET.OLEDB.4.0', 'Database=D:\bhuvneshew.xls;Extended properties=Excel 8.0', 'select * from [Sheet1$]')
select top 10 * from sysobjects

----------------------------------------------------------------------
---Error Occurred
OLE DB provider "MICROSOFT.JET.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "MICROSOFT.JET.OLEDB.4.0" for linked server "(null)".


--------------------------------------------------------------------------
--- Linked server settings

EXEC master.dbo.sp_addlinkedserver @server = N'EX_LINK', @srvproduct=N'excel', @provider=N'Microsoft.Jet.OLEDB.4.0', @datasrc=N'D:\bhuvneshew.xls', @provstr=N'excel 8.0'
GO
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'EX_LINK', @optname=N'use remote collation', @optvalue=N'true'


---------------------------------------------

Please help me


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #610126
Posted Friday, November 28, 2008 7:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
Here's an OPENROWSET Excel insert which has been working for a while:
-- INSERT the results into the newly-created spreadsheet
INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE=\\ReportingServer\D$\EDIInvoices.xls',
'Select * from EDIInvoices')
SELECT * from #EDIInvoicesPivot

Remember, this statement is running on the SQL server, not on your desktop, so the location of the Excel file is relative to the server. In the example above, the Excel file is on another (reporting) server.

Cheers

ChrisM


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #610333
Posted Monday, December 1, 2008 1:42 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 2:36 AM
Points: 2,840, Visits: 3,970
so i cannot insert that SQL table data into Excel(Placed at local drive)
Am i right ?


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #611071
Posted Monday, December 1, 2008 2:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
bhuvnesh.dogra (12/1/2008)
so i cannot insert that SQL table data into Excel(Placed at local drive)
Am i right ?


If the instance of SQL server which is executing your statement can "see" your local drive, then it can also write to it.


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #611082
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse