Need SQL Query which saves query results to an excel file

Hi,
I am looking for a sql query which saves/ export results of an query to a excel file
Thanks,
Chetan

I am looking for a sql query which saves/ export results of an query to a excel file
Thanks,
Chetan
Options:
1) You can use
BCP command to export result to excel
2) Insert into excel by using OPENROWSET
3) Use Import and Export Wizard and provide SQL query as source and Excel as destination
Please refer:
http://stackoverflow.com/questions/87735/how-do-you-transfer-or-export-sql-server-2005-data-to-excel
http://www.codeproject.com/Questions/617527/Export-sql-query-result-in-excel-file
Cheers,
Vaibhav Chaudhari
[MCTS],
[MCP]

Similar Messages

  • Sending query results to an excel file

    hai friends,
    Can any one help me out in sending the results of a query to an excel file once i press a button on my jsp.
    I need to display the results of the query and has to send those results to the excel file.
    Thanks and regards,
    ravikiran

    The solution is simple and the trick lies in setting the Content Type of the response and producing the output.
    If we remember, while coding in servlets, one needs to set the content type on the response object. For outputting in Excel format, the content type has to be set as "application/vnd.ms-excel"
    Once this is done, the servlet knows that it has to produce the output in MS Excel Sheet.
    You can query the databsae and loop over your record set and output it in any manner you like.
    eg
    <!-- Printing the Row Headers-->
    out.println("Header1 \t Header 2 \t Header3");
    <!-- printing the actual values from database-->
    while(rs.next()){
    out.println(rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3));
    Hopefully this will work for all of you.
    Thanks

  • Display the query result in an Excel file??

    hi there..
    am writing one script file that queries my DB and display the query result in an Excel file??
    i.e: if my query is :
    select col1, col2
    from table;
    and i want the results to dispalys in 2 col. in an Excel spreadsheet..
    Appreaciating ur cooperation..
    Mourad

    set colsep to a delimiter that is not normally part of your data like |
    also setup the environment with these other setup commands
    Set Echo Off;
    Set Concat Off;
    Set Pagesize 9999;
    Set Feedback Off;
    Set Verify Off;
    Set Term Off;
    Set Space 0;
    Set Colsep '|'
    Set Underline Off;
    If you wanted to use a comma delimiter the setup would be same but the set colsep='","'
    with the addition of concatenating a " on the first col and last col of the query
    eg.
    -- if first col and last_col are character types then
    SELECT '"'||col1,....,last_col||'"'
    FROM table;
    Otherwise if either is a number they would have to be converted with a TO_CHAR

  • In Premiere I can edit an avi or mov clip but I can not save the result as a like file.  Why not???

    In Premiere I can edit an avi or mov clip but I can not save tghe result as a like file.  What do I have to do???  It only saves a project.  Under 'File' the 'Export' function is greyed out.  I need help baddly.
    [email protected]
    Bill Schoon

    Boatbuilder
    Let us start from the beginning.
    It has been established that you have Premiere Elements 10. On what computer operating system is it running?
    There has not been a File Menu/Export/Movie export opportunitity in Premiere Elements since version 7. We are not up to version 12.
    For Premiere Elements 10, your export opportunities are all in Share/ including one for Computer. Under Computer there are several choices. The ones that you see are Adobe Flash Video, MPEG, and AVCHD. The others you have to scroll down to. And those choices are AVI, Windows Media, QuickTime, Image, and Audio. You do not have to use the scroll bar for this. You can click on Adobe Flash Video panel to get it to turn black. Then use the down arrow to go down the list and the up arrow to go up the list. Once you get to a category, you can select a preset and go with it or customize it under the Advanced Button/Video Tab and Audio Tab of the preset.
    If you post the properties of your source media that you want to try to match in the export, I would be glad to suggest the exact settings for you.
    We will be watching for your follow up with details.
    Thank you.
    ATR
    Add On...The Premiere Elements 10 File Menu is for more than Saving, just not exporting. One of the key features that can be access there is the Project Archiver. More on that another time.

  • How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    Thanks for the quick reply.  I figured out how to get the desired results by using tagging.  For anyone who may reference this post in the future, I went to "Customize" in the top right corner of Adobe, then selected "Create new tool set...", looked under "accessiblity and found the "tag" option.  Hit ok, tag is added to the toolbar.  Then I highlighted the dataset in the PDF that was relevant to the output format, then clicked "tag", saved as spreadsheet.  Sorry I can't provide more details on how tagging works or if there's a more elegant solution available, but I'm sure one's out there.

  • How to delete rows in the SQL Server table based on the contents of Excel file

    Hello, everyone,
    I have an Excel file which contains data for certain dates. I need to load it in a SQL Server table. But before doing that, I need to check if the table already contains data for the dates in the Excel file. If it does, I need to delete those data
    first. Not sure what is the best and efficient way to do this. Your help and guidance would be much appreciated.
    Thank you in advance.

    there are multiple ways of doing this
    Fastest method would be below
    1. Have a data flow task using excel source. Then add a OLEDB destination to dump the data to a staging table
    2. Have a Execute sql task to delete data from your actual table based on staging table data. The query would look like
    DELETE t
    FROM YourTable t
    WHERE EXISTS (SELECT 1
    FROM StagingTable
    WHERE DateField = t.DateField)
    3. Have another execute sql task to do final insert like
    INSERT YourTable (Col1,Col2,...)
    SELECT Col1,Col2,..
    FROM StagingTable
    the above operations will be set based and faster
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Need to download the report output list to a Excel file.

    Hi,
       I have a report output list, which i need to download to an Excel file, could any body suggest how to do this with out writing the ws_download.
    My report data is coming from two internal tables, one internal table for left side reprt display and another internal table for right side report display, both the internal tables having the same fields.
    suggest me how to combine these two internal table data in one internal table.
    2 internal table structure is same but data is different.
    Sunil

    Hi,
    in the o/p list use the below menu path.
    LIST>SAVE/SEND>FILE,
    then a pop-up window with different formates will appear,then choose u r required format.
    Thanks,
    Anji

  • Save ALV report output as excel file in background

    Hi all,
    As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
    Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
    And any limitation?
    Thanks!

    Try to create ALV output to spool in background then try to use any of the below mentioned fm
    SAP_CONVERT_TO_XLS_FORMAT
    MS_EXCEL_OLE_STANDARD_DAT
    RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    or
    create CSV using OPEN DATASET & TRANSFER

  • Download ALV result list as excel-file in background job

    Dear Experts,
    I am looking for a possibily to download the result of an ALV based report as excel-file in a background job. Surely there is a standard function which can be used or at least some hints how to implement this. I searched the forum but couldn't find a thread which was covering this problem exactly.
    Thanks in advance
    Benjamin

    Dear Mr. Krapf,
    it is possible to output an ALV list to an Excel file in the background but there are some limitations.
    Please consider the following notes:
    #7925  Graphics, Upload, Download do not work in backgrnd
    #65050 Data types and file formats in files (DATASET) 
    #145073 - FAQ Report Writer: Excel download 
    #569537 - Incorrect data during import into Excel
    #590126  Sending CSV documents up to Release 4.6
    Please be aware that they are all Basis notes. So for more information you might ask in the Basis SDN Forum.
    Best regards, Christin Angus

  • Why can I not save my changes to an Excel file in Numbers?

    I opened an Excel file in Numbers and made some modifications.  Now, trying to save it to a numbers file, I get the message, "The file 'filename.numbers' couldn't be opened.  How can I save this file?

    oddly, i needed to restart my computer for another issue (i could not hear any sound no matter what i did).  luckily, apple has had the insight to include automatic recovery of files and i was able to re-open these applications and have my unsaved files intact.  even more strangely, i was able to save my file with the original name.
    as a pc & windows convert, this whole thing was a little disconcerting.  perhaps i am just used to that environment, but i have never had something like this happen there.  (though perhaps i have had other things... )
    thanks for the attempts to help!

  • Save as dialog window for excel file save ....

    hi!
    i have a jsp that displays all the report names to the clients and when clicked on the report downloads an excel file and saves to the client machine.this is accomplished by calling a servlet that sets the content type as "application/octet-stream" and setting the header as "setHeader("Content-Disposition", "attachment; filename=myExcel.xls")
    and writing the bytes to the excel file.works just perfect.
    now if you open the excel file and make changes to it and try to save it with a different name by clicking 'save as' option from file menu, the 'save as file type' by default shows "text" instead of excel worksheet.
    have you guys come across this problem anytime....
    kindly let me know you have any suggestions ..
    thanks in advance,
    /rahul

    one more point:
    the save as list box displays "myExcel.xls"(with quotes) where it should have displayed simply myExcel.

  • 'Save As' operation on an excel file (Urgent) ?

    Hi All,
    I have an excel file in my project directory. I want to save or make a copy of that excel file in the directory with a different name i.e. i want to do 'Save As' operation on it whenever user clicks some button. Thanks in advance
    Best Regards.
    Umer.
    Solved!
    Go to Solution.

    If you only want to save a file with a new name, in the button callback you can:
    (Optional) Use FileSelectPopup to let the user choose the file to operate on. Function will return the complete pathname of the file in a string variable
    Use SplitPath to extract the file name and change it accordingly with standard string functions
    Use MakePathname to rebuild the complete file pathname in a new string variable
    Use CopyFile to operate the copy
    All this does not open the file to examine its content.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Save ALV grid to local excel-file in background

    Hi,
    i want to save a alv grid to an excel-file on a local fileshare using an background job..
    Does anybody know how this works?
    Thanks ahead

    DATA: file TYPE string VALUE `flights.dat`,
          wa   TYPE spfli.
    FIELD-SYMBOLS TYPE x.
    OPEN DATASET file FOR OUTPUT IN BINARY MODE.
    SELECT *
           FROM spfli
           INTO wa.
      ASSIGN wa TO CASTING.
      TRANSFER TO file.
    ENDSELECT.
    CLOSE DATASET file.
    <b>The binary data from database table SPFLI is transferred to a binary file flights.dat</b>

  • Can you batch save as pdf's to excel files

    I was wondering if there was a way of batch saving a number of PDF documents to EXCEL files so then we can collate and graph the data from there.

    Hi Chris ,
    I would request you to refer the following document that explains how to batch save files .
    http://blog.rtwilson.com/how-to-batch-export-pdfs-to-other-filetypes-in-adobe-acrobat/
    See if that solves your purposes and fixes the issue for you .
    Regards
    Sukrit Dhingra

  • 1 Analog Input using a DAQ card and would like to save the data into an excel file

    As you may have realized, I am very new at using Labview 6.1. I have an analog voltage input that I would like to save in an Excel file as a 2D array (time, voltage). I was wondering if anyone knew a very simple way of doing this and could help me out. Thanks

    There are a couple example program online and in LabVIEW that I think you’ll find useful. You might want to consider just writing out a tab-delimited spreadsheet file that Excel can read rather than writing it out to Excel directly as this requires learning ActiveX and Microsoft’s Common Object Model.
    In LabVIEW, see the Write to Text File.vi in C:\Program Files\National Instruments\LabVIEW 7.1\examples\file\smplfile.llb. Writes simulated, timestamped data to a text file in ASCII format that can be read by spreadsheet applications.
    Online, you can look at:
    Stream Scaled Data (Voltages) to a Spreadsheet File
    Chart Analog Data from File, Using the Cont Acq to Spreadsheet.vi Example
    Hope this helps. Best of luck!
    Kileen

Maybe you are looking for

  • Open request not showing in the report

    Hi, We have built a query for planning to show open request. After 50,000 records, the request would be closed in the infoprovider. In the query, Request id is restricted with the most current data variable. In Dev, the report shows the open request.

  • Materialized view from prebuilt table doesn't work with spatial types?

    Hello, I'm trying to build a materialized view of a table using the prebuilt option and a pre-built table. Oracle gives me an ORA-32304 error, saying it can't do this with user-defined types. The original table has no user-defined types, but does use

  • What is the latest version of Keynote?

    I have Mavericks and I am asking what the latest version of Keynote is? Are there any tutorials on using the latest version? Also in asking you knowledgeable folks here. Is the latest version capable of doing CAD type drawings such as Autocad? Or do

  • Web Export

    ok I shot some footage -- 720x480 SD at 24fps anamorphic 16:9 aspect ratio -- looks great but Ive been trying to export it for the web and Im getting nowhere fast! I tried "Export Quicktime Movie" and Ive tried to use Quicktime conversion... when I t

  • SOLMAN 7.0 (SR3) Installation Error

    Hi, Experts I am trying to install solman 7.0 in windows/db2. In one phase i am getting error, i am unable to solve this issue. Please help me to resolve the issue. WARNING 2009-01-02 10:25:57.906 Execution of the command "D:\usr\sap\ISM\DVEBMGS00\ex