export data to Excel using sql stored procedure

  • I'm having a Sql Table which contains 1000 records...Now i want to export this records to excel sheet by using stored Procedure into my local systam...Please any One Help me.

  • Why do you want to do this?

    Does copy (from the results in SSMS) and paste (to Excel worksheet) not give you what you want?

  • from .net we call the storeproedure then automatically exec the sp and donload the excel file.so we need the excel donload the file store procedure.

  • Assuming this Excel file will not be so large that you cannot do this synchronously, reliably...another idea would be a design where the Excel file would be created by the .NET code. Steps:

    1. From .NET code, call Stored Procedure to get data you need from the database.
    2. From .NET code, create the Excel file using the data you retrieved in Step 1.
    3. Deliver the Excel file to the caller.

    If the data set and resulting Excel file will be rather large, too large to do in a single call synchronously, then consider designing the process to have the Excel file created asynchronously.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • polo.csit - Tuesday, April 11, 2017 7:39 AM

    I'm having a Sql Table which contains 1000 records...Now i want to export this records to excel sheet by using stored Procedure into my local systam...Please any One Help me.

    I know this post is several months old now but would it be useful to make a spreadsheet that called the "external data" from the database rather than try to push it from the database?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Tuesday, August 22, 2017 10:10 PM

    polo.csit - Tuesday, April 11, 2017 7:39 AM

    I'm having a Sql Table which contains 1000 records...Now i want to export this records to excel sheet by using stored Procedure into my local systam...Please any One Help me.

    I know this post is several months old now but would it be useful to make a spreadsheet that called the "external data" from the database rather than try to push it from the database?

    Assuming the person receiving the Excel Workbook via the website would be allowed to have a connection to the backend database it could work but it sounds like a case where a web app just needs to deliver a static Excel Workbook with data from the database in it.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 6 posts - 1 through 5 (of 5 total)

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