Data converted to Excel file

  • How can I convert data to Excel file using sql query.

    thanks

  • Is there a reason you need to do this w/ T-SQL?

    There are two other easy ways to do this:

    If this is something that needs to be done rarely, and if the amount of data isn't huge (say 10,000 large rows), you can run the query in Query Analyzer, click on the cell that's above the row number and to the left of the column names (upper left) to select all the data, and copy and paste it into an empty Excel document.

    If this involves a lot of data, or should be trivially repeatable, you should look at Data Transformation Services (DTS). It lets you copy data from a table to an Excel file.

    RD Francis


    R David Francis

  • Thanks for the reply.

    Actually, I have created a stored procedure with two parameter which return data and I want that data should be transfer to Excel file whenever the stored procedure will run.

    I did this long time back but I totally forget.

    I cannot use DTS because I don't how to run DTS from client side. The user who is going to run this SP has no access to SQL Server.

    I am still figuring out what client application should I use to run the Stored Procedure and then transfer data to excel file.

  • I think you can still use DTS, here's how:

    open DTS wizard, choose export data,

    pick source (possible problem here w/ login & permission)

    pick destination (Excel and save to user's network folder?)

    pick sql query

    EXEC your_stored_procedure

    make any modifications you need

    save to a file

    You can save the file to the client's desktop... problem is your client will still need access to Enterprise Manager or the DTS wizard to run that file (I think!) Hope that helps.

Viewing 4 posts - 1 through 3 (of 3 total)

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