Stored Procedure EXEC in Excel

  • texpic

    SSCertifiable

    Points: 5882

    There is a SQL database that I have read access (can run a query) but can't modify stored procedures, etc. I have complex stored procedure that I run against that database, then I cut/paste the results into Excel. The stored procedure requires modification from time to time otherwise I'd have the DBA add it as a procedure in that database.

    Is there a way I can embed the stored procedure into Excel and have it automatically update the spreadsheet? I've played around with Excel, made the connection to the server but can't seem to figure out how to make the stored procedure part of the Excel sheet.

    Thanks

  • Lowell

    SSC Guru

    Points: 323450

    you could create a temporary stored procedure.

    whether you can do it through excel, i'm not sure, but thios example works just fine; your proc obviously woudl be more complex

    CREATE PROCEDURE #tmp

    AS

    SELECT top 10 * FROM EDLogDetail ORDER BY EDLogDetailId DESC

    GO

    EXEC #tmp

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply