Copying Query & Formatting on Worksheet to New Worksheet in Same Workbook

Hi,
Can anyone advise me the quickest way to copy a query that is working on one worksheet to a new worksheet. More importantly how do I retain the formatted features of the worksheet from which I am coping from? I have tried to copy the query to a new worksheet which is OK but I cannot seem to retain the format features from the original worksheet. Am I missing something simple?  We are on version 3.5.
Thanks

Shanky_621: Thanks for taking the time to help. The following blog article talks about what I'm trying to do:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914288
The goal is to recreate the inefficent plan on a test database without copying the data. The article talks about this as a "statistics only copy".
You noted, "SQL server generating query plan is internal mechanism into which we cannot interfere unless we use Query hint...". The engine uses statistics and histograms to generate plans then choose the most efficent one for execution. Those statistics
are generated from data in the database, and that process is done periodically. You don't think the engine actively scans each table in a query each and every time a query is run? Right! That would be crazy. It just checks the stats. What I'm trying to
do is pull the stats from one database into another. The article does a better job explaining this.
JRStern (Josh): Yes brother! You understand what I'm trying to do. Like you, I am wrestling with a feature/process I've only read about. The actual execution is... not as expected. I actually just found the article I noted to Shanky. I'm trying that process
now. I'll tell you how it goes.
Adam

Similar Messages

  • Populate Result of query in Different worksheets of One Workbook in Excel.

    I want to get output of different queries to be populated in Different Sheets of a workbook of Excel in Unix/Linux Environment.

    Here is an example perl script using the Spreadsheet::WriteExcel CPAN module that might help:
    ===#!/usr/bin/perl
    use strict;
    use DBI;
    use Spreadsheet::WriteExcel;
    my ($toc,$data_sheet,$f,%data,$workbook) = ();
    my ($workbook_filename) = "mytest.xls";
    $workbook = Spreadsheet::WriteExcel->new($workbook_filename);
    sub build_excel_workbook {
      $workbook->compatibility_mode();
      $f = \%{$data{excel_format}};
      $$f{bold} = $workbook->add_format();
      $$f{bold}->set_bold();
      $$f{right_align} = $workbook->add_format();
      $$f{right_align}->set_align("right");
      $toc = \%{$data{excel_table_of_contents}};
      $$toc{tab} = $workbook->add_worksheet("Table of Contents");
      $$toc{tab}->freeze_panes(1,0);
      $$toc{tab}->set_column(0,1,20);
      $$toc{tab}->write(0,0,"WorkSheet Name",$$f{bold});
      $$toc{tab}->write(0,1,"Comments",$$f{bold});
      $data_sheet = \%{$data{excel_data_sheet}};
      $$data_sheet{tab} = $workbook->add_worksheet("EMP table");
      $$data_sheet{current_row} = 0;
      $$toc{tab}->write(1,0,"EMP table");
      $$toc{tab}->write(1,1,"Example WorkSheet containing EMP sample data");
    build_excel_workbook();
    my $db = DBI->connect( "dbi:Oracle:Local", "scott", "tiger" )
        || die( $DBI::errstr . "\n" );
    $db->{AutoCommit}    = 0;
    $db->{RaiseError}    = 1;
    $db->{ora_check_sql} = 0;
    $db->{RowCacheSize}  = 16;
    my $SEL = "SELECT * FROM EMP";
    my $sth = $db->prepare($SEL);
    $sth->execute();
    while ( my @row = $sth->fetchrow_array() ) {
        for (my $i = 0; $i <= $#row; $i++) {
            $$data_sheet{tab}->write($$data_sheet{current_row},$i,$row[$i]);
        $$data_sheet{current_row}++;
    END { $db->disconnect if defined($db); }
    #end_script===
    Best Regards,
    Bryan Wood
    Edited by: BryanWood on Jan 26, 2012 4:07 PM
    Edited by: BryanWood on Jan 26, 2012 4:10 PM

  • Worksheet content being overwritten by another worksheet from same workbook

    Has anyone else experienced this issue in Plus and Viewer.
    On a handful of occasions now I have had the data content part of a worksheet overwritten with that from another worksheet within the same workbook. The title, text area and worksheet descriptions stay the same, but the items selected in my crosstab, the conditions used, calcs used are replaced with those used a different worksheet. The worksheets are all using items from the same folders in the EUL, but each one selects slightly different columns from the others and each has a couple of specific conditions.
    This happened today when I switched from one worksheet to another in Plus, then back to the original sheet. The original sheet data content was overwritten by the content from the worksheet I had switched to!!
    The worksheet is only being accessed via Plus and Viewer, not Desktop and the version is 10.1.2.48.18.

    Hi,
    I'm with Russ. This sounds ugly and I've never seen it before. However, there is another interesting thing that happened to someone else in 9.0.4 version recently where the workbook was owned by one owner, shared to another, a modification made to the workbook by the shared to userid. The original workbook accepted the change. It sounds like this was caused by IDENTIFIER issues. Could it be possible, (improbable I think), that the IDENTIFIER on each worksheet is the same? I don't know how this could happen but I bet a million dollars once (that I don't have) that the workbook situation couldn't happen. To check this, right click on each worksheet name and checkout the IDENTIFIER. I also think you should log a SR. It would be nice if you would post the resolution here once one is found.
    The workbook issue has been logged as bug 7565438 . (problem identified by stephen lee)
    Thanks for sharing an interesting issue!
    Nancy

  • Need to delete blank rows from various worksheets in same workbook-reg

    Hi Team,
    I am searching for a macro to delete the blank rows from my worksheets.
    Sub testIt()
    Dim r As Long, endRow As Long, pasteRowIndex As Long, Worksheet As Object
    Application.ScreenUpdating = False
    endRow = 1000
    pasteRowIndex = 1
    For r = 1 To endRow
        If Cells(r, Columns("A").Column).Value = "12345" Then
                Rows(r).Select
                Selection.Copy
                Sheets("12345").Select
                Rows(pasteRowIndex).Select
                ActiveSheet.Paste
                CutCopyMode = False
                pasteRowIndex = pasteRowIndex + 1
                Sheets("NORMAL").Select
    End If
        If Cells(r, Columns("A").Column).Value = "45678" Then
                Rows(r).Select
                Selection.Copy
                Sheets("45678").Select
                Rows(pasteRowIndex).Select
                ActiveSheet.Paste
                pasteRowIndex = pasteRowIndex + 1
                Sheets("NORMAL").Select
        End If
        If Cells(r, Columns("A").Column).Value = "36925" Then
                Rows(r).Select
                Selection.Copy
                Sheets("36925").Select
                Rows(pasteRowIndex).Select
                ActiveSheet.Paste
                pasteRowIndex = pasteRowIndex + 1
                Sheets("NORMAL").Select
        End If
         If Cells(r, Columns("A").Column).Value = "789456" Then
                Rows(r).Select
                Selection.Copy
                Sheets("789456").Select
                Rows(pasteRowIndex).Select
                ActiveSheet.Paste
                pasteRowIndex = pasteRowIndex + 1
                Sheets("NORMAL").Select
    next r
    end sub()
    the above code searches for the value "12345" "45678" "36925" "789456" if found in worksheet (normal) then it picks the value and paste it in new corresponding worksheet with sheet number (12345). while pasting like
    this it has some blank rows so it need to delete the rows help me out of this problem. thanks in advance

    Hi vigneshvicky,
    This code snippet works fine to delete the blank rows, please try it:
    ActiveSheet.UsedRange.Select
    'Deletes the entire row within the selection if the ENTIRE row contains no data.
    Dim i As Long
    'Turn off calculation and screenupdating to speed up the macro.
    With Application
    .Calculation = xlCalculationManual
    .ScreenUpdating = False
    'Work backwards because we are deleting rows.
    For i = Selection.Rows.Count To 1 Step -1
    If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
    Selection.Rows(i).EntireRow.Delete
    End If
    Next i
    .Calculation = xlCalculationAutomatic
    .ScreenUpdating = True
    End With
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I copy SQL results to different csv worksheets in the same workbook

    Hi all,
    I'm running a series of select statements using SQLPlus and I want the results for each statement to be copied to different worksheets within the same workbook.
    For example, this is what I want: 'select statement 1' is run and spooled to file.csv / worksheet1. When 'select statement 2' is run it is spooled to file.csv / worksheet2. Same csv file but a different worksheet.
    Right now my SQL is creating a seperate csv file for each select statement. Here's an example of my SQL:
    spool c:\TEMP22\App_Eng1.csv replace
    Select A.OBJECTOWNERID||','||B.OBJECTVALUE1
    from PSPROJECTITEM B, PSAEAPPLDEFN A
    Where B.PROJECTNAME = 'PRJETSC342'
    and B.SOURCESTATUS = 2
    and B.TARGETSTATUS = 1
    and B.OBJECTVALUE2 = ' '
    and B.OBJECTTYPE=33
    and A.AE_APPLID = B.OBJECTVALUE1;
    spool off
    Is what I want to accomplish possible? Any ideas? Thanks.

    As far as I know you can't have "worksheets" for .csv files. They are simply comma separated values (a flat file). I would suggest that you generate separate csv files for each of your queries and then create a new xls file and import each csv file as a new worksheet.
    If you want to automate this process, I recommend you read this:
    http://blogs.msdn.com/brian_jones/archive/2005/06/27/433152.aspx

  • Copy query (SQ01) to new query with new infoset

    Hi,
    Not sure if this is correct forum.
    Is there a way to copy existing query with an infoset to a new query using another created infoset?
    If so, please explain how.
    Kind regards

    Hi,
    If you want to copy a query for another infoset its not possible.
    The copied query will work for that infoset only which you have been generated.
    You need to make a new infoset and than create a new query for it.
    Regrds,
    Nikhil.

  • I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    click and hold on one cell, then drag to select the range, then release, then type the delete key.  Only inlude cells in the range you do not want to keey the contents of the cell.  You can remove one-off cells by holding the command key and clicking cells to add or remove as needed.
    You can download the Numbers users guide here:
    http://support.apple.com/manuals/#productivitysoftware

  • Where has the copy query button gone to in BEx Anlayzer 7.0?

    Hi,
    In BEx Analyzer 3.5, there is a copy query button under tools. It allows you to copy query within a workbook to another sheet.
    I can't find this button in BEx Analyzer 7.0.
    Any idea on how to get this copy query button back?
    Thanks.

    A good workaround is the "Add Drilldown According to..... in New Worksheets" context menu selection. Once you have your worksheet/report the way you want it, from the navigational panel with free characteristics, choose a field that has one or two values in it (you can put in filter values to do this, ie 2 calendar years). Right click and choose the entry "Add drilldown according to...".  This will create new worksheets for every value contained in the infoprovider for that characteristic (hence the need to apply a filter).  The new worksheets will be a replica of sheet one, filtered by and named by the characteristic values you've chosen. 
    From there you can continue to filter, drilldown, etc.
    Hope that helps,
    Bill Coombs

  • I have a rather old iMac 20" (mid 2007) and I want to upgrade the Hard drive. How do I change it? How do I transfer all my applications? May I just copy the old hd into the new one? Thanks.

    I have a rather old iMac 20" (mid 2007) and I want to upgrade the Hard drive. How do I change it? How do I transfer all my applications? May I just copy the old hd into the new one? Thanks.

    There are many online tutorials on how to change out the HD on a mid 2007 iMac. One of the originals is from 2007 and is Upgrade your iMac 20" or iMac 24" aluminum (mid 2007) to 1TB Hard Drive and 4 GB RAM - DIY Guide. As far as migrating your system Apple helps out with that in Setup Assistant which automatically starts when you turn on a new Mac for the first time. After you have installed the new HD you will have to format the new HD to Mac OS Extended (Journaled) and then you will have to install OS X. The first time you turn it on Setup Assistant will start. Follow the directions and you will be fine. In order to restore your information you will need to backup what is on the current internal HD first. I'd recommend using Time Machine (Assuming you are using Leopard or later) AND also creating a bootable clone using either SuperDuper or Carbon Copy Cloner.
    Please complete your profile so at the very least we know what version of OS X your machine has installed.

  • Copying Boot Camp Vista partition to new hard drive

    This is OS X Lion using Boot Camp version 4.0.4 with Vista on a separate hard drive. I want to move it from an 80Gb drive to a 1Tb. Looking for the quick and cheap way of copying the bootcamp partition to the new drive because it's the same Mac Pro so only the drive size will be different. Google searches has me using two software to copy the Apple bootcamp and Winclone to copy Vista.
    Isn't there a simpler way without purchasing software I will only use once? I'd rather just reinstall Vista and the other software manually than pay anything over $20 to do it.
    Any advice is appreciated.

    My apologies. I didn't make myself clear. I followed the proper procedure and got the error message. I tried the other formatting to see if it would help. All the same results.
    I found a possible solution on another Apple thread. I am going to move the drive to have Vista installed moved to the first stall on my Mac Pro 1.1. It is claimed that this will bypass the issue of GP if do that. Then after installation I can switch them back.
    I will post the results. I had no issue the first two times I did this since using Bootcamp when I first got this Mac Pro over 7 years ago.

  • How to Copy the formatting of text already in an indesign document?

    Hello everybody.
    I'm still fairly new to indesign and am self taught so feel I have missed some of the little tools that make life simpler.
    One such problem I'm having is that when I import text into my brochure I'm creating, I need it to be formatted the same as the rest of the text in my project. Is there a simple way for me to copy the formatting style in the rest of the document or do I have to choose the specific font, colour, size and justification every time I import some new text?
    I know in Microsoft word for example there is a specific button which copy's the formatting from one section of text to another, is there a similar kind of button in indesign?
    Thanks
    Ant

    You can use the Eyedropper tool to copy type  attributes. But you are probably much better off learning how to use Paragraph Styles and applying them consistently. That way when you need to make a change, all your paragraphs will update in lock-step.

  • Insert or copy query into workbook 7.0

    How Can I copy a query into a workbook with new Analyzer 7.0 ?
    In the old version (Analyzer 3.x), I can choose Tools->Insert (or copy) query.
    How Can I do the same with Analyzer 7.0 ?
    Thanks

    Hi,
    .) Open the analyser and connect to the BI system,
    .) open an empty excel
    .) switch to design mode (first icon on second task menu)
    .) insert a table (second icon on second task menu)
    .) select the query
    and so on...
    BR
    /C

  • Copy Field Formats into multiple fields

    I have a form that has a spreadsheet layout. Multiple fields need to be formatted as currency or date. Outside of using Java scripts is there a way to copy the formatting of one filed to multipe others? I want to avoid Java script because I'm lousy with it.

    Is it possible to have each field separated by a comma? Space
    delimiters won't work since not all cities & states are one
    word (ie. New York, New York) however a comma delimiter would allow
    you to use simple list functions to extract the data.
    If this isn't possible but the data is always in the format:
    city<comma>state<space>zip, then you could extract the
    city using comma as the delimiter and then extract the zip code
    using the ListLast() function with space as the delimiter which
    would leave you with the state as the remaining text. This would
    only work however if your data is consistently in the format
    described above.
    Failing this you could build two tables with states and
    cities and then use them to identify valid states and cities and
    extract the data that way.
    cheers

  • Copied query not changeable when "Changeable Original" setting used.

    Hi
    We are letting users create queries in Production.  All the authorisations are working as designed.  We have settings for query elements set to "Changeable Original" in the object changeability.
    When a user creates a new query they can save it, change it, save copies, all as required.  The expectation is that they would be able to copy a query that originated in another system but was transported and save it under a new technical name and change it.  This is not possible.  It is as though the system thinks that the copy originated in the other system and as such cannot be changed. 
    If we change the query elements to "Changeable Everything" it all works but we do not want this setting for obvious reasons.
    Has anyone come accross this?  Can anyone suggest a way to fix this issue?
    Thanks
    Gareth

    Hi Chetan, VNK
    Thanks for your replies...
    We have made the decision to allow query developement to a limited user community in Production.  This has it's own name space different from the name space used for the transported queries.  There are many reasons for this approach which i won't go into (unless you want me to...)!
    The users do have the correct access to create in production.  They are able to create and change new reports within their namespace within their InfoArea and all that is working fine.  I would expect that opening and existing query in production and saving a copy in their namespace, that the new query should be changeable.  Would you not expect this?  You are correct, i do not want them to be able to change queries that originated in the development environment but the name space control combined with the changeable original setting in object changeability should control this.
    The error i get is not a transport error...it is a system changeability error suggesting that the system thinks the new query was not created in production.
    Any further ideas?
    Thanks
    Gareth

  • Copy Query from One MultiProvider to Another

    How easy is it to copy a Query from one MultiProvider to another?
    thanks

    If the elements of the query is not same try using following function module RSZ_I_COPY_QRY_TO_CUBE to copy queries
    Re: Copying query structure to new infoprovider
    Ravi

Maybe you are looking for

  • How can I use my iMac (2007) as an external display to my MacBook Pro (2013) while in bootcamp?

    I have an old 2007 iMac laying around that is too slow for use as a second computer, however I could greatly benefit from a second monitor for what I'm doing on my 2013 MacBook Pro while in bootcamp's windows mode (Photoshop, Illustrator, Rhinoceros,

  • ADFC-10001 Error while creating user in oim

    Hi All, I am getting ADFC-10001: cannot instantiate class 'oracle.iam.identitytaskflow.backing.taskflows.createuser.createuserview' error while creating user. ADF_FACES-60097:For more information, please see the server's error log for an entry beginn

  • MARA table going DUMP due to append structure

    Hi all, I have created the structure and i have Appended  to MARA table. Since then MARA Table is Partially  Active State. So, i tried to delete the structure. But i am unable to delete that Structure, because it was used in MARA Table. Even i tried

  • Ca I load CS5 in the background, at startup?

    Bridge has an option to load in the background at startup, but I don't see any such for CS5. Is that possible? I know I can put CS5 in the startup folder, but that will not run it in the background. I'd like to do this to save time when going between

  • Muvo2 (not fm) firmware probl

    My muvo2 boot only the recovery utility for firmware problems. I downloaded the firmware for it, but if i try to run the program, windows Xp crash. Who can help me?