0

I have many stored procedures within a SQL Server database which get called from different Excel workbooks, but this one refuses to run.

The stored procedure runs within SQL Server and runs as expected in MS Access 2010 as a query

exec V2_PltOvrVw

However when I try to pull the same result into Excel using my normal methods:

DATA TAB - Connections - Add

DEFINITION TAB - Command Type = SQL - Command Text = dbo.exec V2_PltOvrVw

In a cell I then go to existing connections and open my newly created db link I get the following unhelpful message

The query did not run or the database table could not be opened Check the database server or contact your database administrator. make sure the external database is available and hasn't been moved or reorganized, then try again

on clicking OK I then get

The following data range failed to refresh ExternalData_1 Continue to refresh all?

The only differences I can see are that this stored procedure firstly writes to 6 temporary tables before joining them all together and creating an aggregated output.

I have also tried to copy the sp code directly into the command text but that does not work either, suggesting that there is a real reason for this that I do not yet understand.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Possible duplicate of [Table in Excel from SQL Server stored procedure with parameter field in workbook](http://stackoverflow.com/questions/12693967/table-in-excel-from-sql-server-stored-procedure-with-parameter-field-in-workbook) – Evaldas Buinauskas Nov 19 '15 at 11:10
  • If I try and run the sp from a new workbook the same thing happens – Martin Lucas Nov 19 '15 at 11:21
  • Please, try this one - it works with temp tables as well: http://www.codeproject.com/Tips/859449/Executing-A-Stored-Procedure-From-Excel-Sheet – Jivan Nov 19 '15 at 11:26

0 Answers0