ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OLEDB - INSERT INTO Excel FROM Stored Procedure (https://www.excelbanter.com/excel-programming/344771-oledb-insert-into-excel-stored-procedure.html)

DevInstinct

OLEDB - INSERT INTO Excel FROM Stored Procedure
 
Is it possible to insert data in Excel from a *Stored Procedure* using
OLE-DB?

I use something like:
INSERT INTO [Sheet12$] SELECT * FROM [odbc;Driver={SQL
Server};Server=blabla;Database=Northwind;User
ID=bla;Password=bla].Orders

I'd like to use something like:
INSERT INTO [Sheet12$] EXECUTE [odbc;Driver={SQL
Server};Server=blabla;Database=Northwind;User
ID=bla;Password=bla].GetOrdersProc()

Thanks


David Lloyd[_3_]

OLEDB - INSERT INTO Excel FROM Stored Procedure
 
One alternative is to use ADO to connect to the SQL Server database, create
a recordset based on the stored procedure, and then use the
CopyFromRecordset method to insert the data in Excel. The Execute method of
the ADO connection object allows you to specify a SQL Server stored
procedure. The following KB articles provide more information.

http://support.microsoft.com/default...b;en-us;306125
http://support.microsoft.com/default...b;en-us;247412

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"DevInstinct" wrote in message
oups.com...
Is it possible to insert data in Excel from a *Stored Procedure* using
OLE-DB?

I use something like:
INSERT INTO [Sheet12$] SELECT * FROM [odbc;Driver={SQL
Server};Server=blabla;Database=Northwind;User
ID=bla;Password=bla].Orders

I'd like to use something like:
INSERT INTO [Sheet12$] EXECUTE [odbc;Driver={SQL
Server};Server=blabla;Database=Northwind;User
ID=bla;Password=bla].GetOrdersProc()

Thanks



DevInstinct

OLEDB - INSERT INTO Excel FROM Stored Procedure
 
Thanks, but I need to run this server-side. Using automation is not an
option. I can do with the select. I just want to know if there's a way
WITH OLE-DB to call a stored proc in the same manner I call the select.



All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com