SQL 2008 R2; Have a query copy to Excel

Posted on 2011-04-26
Last Modified: 2012-06-27
Is there a way to have the query run then copy to Excel on the local drive?

I am familiar with Visual Fox Pro doing this and was wondering if possible in SQL Server 2008 R2.

We are converting to use SQL Server now....

Question by:jaymz69
    LVL 37

    Accepted Solution

    Should be possible through the OPENDATASOURCE() function, have a look here for a similar Q:
    LVL 21

    Expert Comment

    by:Alpesh Patel
    Please change the Result window to File and specify the file name. So, when you execute the Query result will go directly to file.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Query syntax 7 31
    convert this back to a date? 13 51
    Stored procedure 4 21
    pains and challenges of SQL DBAs in 2016.. 2 26
    SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now