Sql run faster using pipe ( | ) ... ???

Hello all,
I have this sql which runs after with the pipes ( | ). below is original sql (from and where clause)
which takes about 2mins to run.....and the other query with pipes (|) and +0 added to the from cluase
runs like in 6secs.....and i wanted to know why the difference ?? what exactly does the pipes do and the
+0 does ??? as its a big difference ?? This was tuned by one of our SR dba...so wanted to know what does
the pipe do that makes the sql so much faster ?
original sql
FROM ((SAMPLE SAMPLE
       INNER JOIN TEST TEST
          ON SAMPLE.SAMPLE_NUMBER = TEST.SAMPLE_NUMBER)
       INNER JOIN SAMPLE ORIGINAL_SAMPLE
          ON SAMPLE.ORIGINAL_SAMPLE = ORIGINAL_SAMPLE.SAMPLE_NUMBER)
       INNER JOIN ANALYSIS ANALYSIS
          ON (TEST.ANALYSIS = ANALYSIS.NAME)
             AND (TEST.VERSION = ANALYSIS.VERSION)
WHERE (ANALYSIS.ANALYSIS_TYPE = 'INORGANIC')
   AND (TEST.STATUS IN ('I', 'C', 'P'))
   AND (SAMPLE.STANDARD = 'F')
   AND (SAMPLE.SAMPLE_NUMBER > 0
        AND (ANALYSIS.X_DATA_TYPE <> 'SUMM'
             OR ANALYSIS.X_DATA_ANALYSIS IS NULL)) sql using pipe and +0
  FROM ((SAMPLE SAMPLE
       INNER JOIN TEST TEST
          ON SAMPLE.SAMPLE_NUMBER = TEST.SAMPLE_NUMBER + 0)
       INNER JOIN SAMPLE ORIGINAL_SAMPLE
          ON SAMPLE.ORIGINAL_SAMPLE = ORIGINAL_SAMPLE.SAMPLE_NUMBER + 0),
       ANALYSIS ANALYSIS
WHERE ANALYSIS.ANALYSIS_TYPE || '' = 'INORGANIC'
   AND TEST.STATUS IN ('I', 'C', 'P')
   AND SAMPLE.STANDARD = 'F'
   AND SAMPLE.SAMPLE_NUMBER > 0
   AND (ANALYSIS.X_DATA_TYPE < 'SUMM'
         OR ANALYSIS.X_DATA_TYPE > 'SUMM'
         OR ANALYSIS.X_DATA_ANALYSIS IS NULL)
   AND ANALYSIS.NAME = TEST.ANALYSIS || ''
   AND ANALYSIS.VERSION = TEST.VERSION

this is the original plan
Plan hash value: 192553293
| Id  | Operation                      | Name           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT               |                | 24263 |  3601K|       | 20979   (2)| 00:04:12 |
|*  1 |  HASH JOIN                     |                | 24263 |  3601K|  3656K| 20979   (2)| 00:04:12 |
|*  2 |   HASH JOIN                    |                | 24263 |  3364K|  2848K| 17399   (2)| 00:03:29 |
|*  3 |    HASH JOIN                   |                | 26698 |  2529K|       | 13784   (2)| 00:02:46 |
|*  4 |     TABLE ACCESS BY INDEX ROWID| ANALYSIS       |   164 |  7216 |       |    47   (0)| 00:00:01 |
|*  5 |      INDEX RANGE SCAN          | IDX_ANALYSIS_1 |   189 |       |       |     1   (0)| 00:00:01 |
|*  6 |     TABLE ACCESS FULL          | TEST           |   800K|    40M|       | 13730   (2)| 00:02:45 |
|*  7 |    TABLE ACCESS FULL           | SAMPLE         |   119K|  5268K|       |  3150   (2)| 00:00:38 |
|   8 |   TABLE ACCESS FULL            | SAMPLE         |   239K|  2341K|       |  3148   (2)| 00:00:38 |
---------------------------------------------------------------------------------------------------------and this is the one of using pipe
Plan hash value: 2901999266
| Id  | Operation                       | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                |             | 25502 |  3785K|       |   158K  (1)| 00:31:47 |
|*  1 |  HASH JOIN                      |             | 25502 |  3785K|  3840K|   158K  (1)| 00:31:47 |
|*  2 |   HASH JOIN                     |             | 25502 |  3536K|  2992K|   155K  (1)| 00:31:04 |
|*  3 |    HASH JOIN                    |             | 28061 |  2658K|       |   151K  (1)| 00:30:21 |
|*  4 |     TABLE ACCESS FULL           | ANALYSIS    |   172 |  7568 |       |    56   (2)| 00:00:01 |
|   5 |     INLIST ITERATOR             |             |       |       |       |            |          |
|*  6 |      TABLE ACCESS BY INDEX ROWID| TEST        |   800K|    40M|       |   151K  (1)| 00:30:20 |
|*  7 |       INDEX RANGE SCAN          | TEST_STATUS |   828K|       |       |  2218   (1)| 00:00:27 |
|*  8 |    TABLE ACCESS FULL            | SAMPLE      |   119K|  5268K|       |  3150   (2)| 00:00:38 |
|   9 |   TABLE ACCESS FULL             | SAMPLE      |   239K|  2341K|       |  3148   (2)| 00:00:38 |
-------------------------------------------------------------------------------------------------------

Similar Messages

  • Report region runs very slow, but its sql runs fast

    We have a page with a report region Type :SQL Query (plsq function body returning sql query) which runs very slow, pegging the tach on our db box for almost a minute before returning report rows. However, if we run the generated sql from sql plus, it returns all the rows in under 10 seconds with nary a blip on the box. Any idas how what could be causing this or how to debug?
    Thanks,
    Steve

    OK, here is the bad boy, shortly after our code that returns the data.
    declare
    rc__ number;
    simple_list__ owa_util.vc_arr;
    complex_list__ owa_util.vc_arr;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 63;
    null;
    null;
    simple_list__(1) := 'sys.%';
    simple_list__(2) := 'dbms\_%';
    simple_list__(3) := 'utl\_%';
    simple_list__(4) := 'owa\_%';
    simple_list__(5) := 'owa.%';
    simple_list__(6) := 'htp.%';
    simple_list__(7) := 'htf.%';
    simple_list__(8) := 'wpg_docload.%';
    if ((owa_match.match_pattern(p_string =>
    'f'
    /* */,p_simple_pattern =>
    simple_list__
    ,p_complex_pattern =>
    complex_list__
    ,p_use_special_chars =>
    false)))
    then
    rc__ := 2;
    else
    null;
    null;
    f(p=>:p);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    null;
    null;
    commit;
    else
    rc__ := 0;
    null;
    null;
    null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    end if;
    :rc__ := rc__;
    end;
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 25.53 26.59 4492 20992 60 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 25.53 26.59 4492 20992 60 1

  • How to tune a oracle sql query to make it run faster ...

    Hi Guys,
    I am very new to this tuning of sql queries. It is taking a lot of time to run a query and give the output. I have a tool called TOAD[ Tool for oracle application development ] and i ran a query in that tool. Its showing that the query is taking 7sec to get its output. I donno the exact procedure what to follow in order to tune that query. What are these actually like : explain plan, sqltrace, tkprof and how to use these to tune the query. I want my query to run faster like in msec.
    Help Appreciated.
    Thanks

    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96533/toc.htm
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018

  • Does SQL Query run faster with/without Conditions....

    Hi All, forgive my novice question.
    Was just wondering" In general if we run a SQL query on a single table; does my query run faster if there are multiple where conditions? or without. What happens if the conditions increase? My table is a big one with 5 million rows and some bitmap indexes defined on it.
    Thanks,
    Kon

    I think it's difficult to give general rule because there are too much dependencies on the fact that the columns are indexed or not, on the way tables and indexes statistics are computed or not, on the possible session or instance parameters that the optimizer may use, on the Oracle version, etc.
    Message was edited by:
    Pierre Forstmann

  • Issue during Running Package using Sql Agent

    hi all
    I have an issue  when I deployed Package and Run package using sql agent.
    before a Successfully Run Package without Any error. but in job It gives me error.
    Executed as user: abc\sqlserver. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.4000.0 for 64-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  08:28:11  Error: 2014-02-12
    08:28:11.86     Code: 0xC0016016     Source:       Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified
    state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0202009    
    Source: PAckageNameReport Connection manager "....................."     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.  An OLE DB record is available. 
    Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E4D  Description: "Login failed for user .....".  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC020801C    
    Source: Import into Excel OLE DB Source [1]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "....................." failed
    with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0047017    
    Source: Import into Excel SSIS.Pipeline     Description: component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC004700C    
    Source: Import into Excel SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0024107     Source: Import into Excel     
    Description: There were errors during task validation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  08:28:11  Finished: 08:28:11  Elapsed:  0.14 seconds.  The package execution failed. 
    The step failed.
    I'm using Sql Authentication.
    Kindly Help.
    thanks

    Hi BI_group,
    According to the error message, the issue may occur due to two possible reasons: protection level of the package or the 32-bit/64-bit driver issue.
    For the first possible reason, it may be that package still uses the default protection level EncryptSensitiveWithUserKey after it is deployed, however, the SQL Server Agent job runs under a different user account. To avoid the issue, you can re-deploy the
    package and set the package protection level to EncryptSensitiveWithPassword or DontSaveSensitive during the deployment. If it is set to EncryptSensitiveWithPassword, we need to configure the Execution options of the job step to use the
    /decrypt password option in the DTexec utility command line to decrypt the encrypted data. If the package is deployed to the SQL Server or SSISDB catalog, we can set the protection level to Rely on server storage for encryption or ServerStorage.
    If it is not the case, check whether it is caused by the 32-bit/64-bit driver issue. For a 64-bit SSIS server, it uses 64-bit drivers by default, however, BIDS/SSDT uses 32-bit drivers unless the Run64BitRuntime property of the IS project is set to true.
    In the BIDS/SSDT, check the Run64BitRuntime property to see if it runs in 32-bit or 64-bit runtime. This enable us to judge whether we need to check the “Use 32 bit runtime” option for the job step.
    Regards,
    Mike Yin
    TechNet Community Support

  • Im not very tech savvy. I use firefox on my desktop, and want to run on my new Asus netbook with Windows Starter. Will FF run faster then IE? What version of FF should I install?

    Im not very tech savvy. I use firefox on my desktop, and want to run on my new Asus netbook with Windows Starter. Will FF run faster then IE? What version of FF should I install? in English
    == This happened ==
    Not sure how often
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MAAU; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU)

    Im not very tech savvy. I use firefox on my desktop, and want to run on my new Asus netbook with Windows Starter. Will FF run faster then IE? What version of FF should I install? in English
    == This happened ==
    Not sure how often
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MAAU; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAAU)

  • Battery running down fast using Yosemite, running the latest update 10.10.2. I think there is bug in this update. Please help me out or is there a way can i switch back to mavericks and how

    Battery running down fast using Yosemite, running the latest update 10.10.2. I think there is bug in this update. Please help me out or is there a way can i switch back to mavericks and how

    1. Check the cycle count of the battery against the rated life for your model. The battery may be due for replacement. If the power adapter is connected almost all the time, the battery may need replacing even though the cycle count is not too high.
    2. Follow these instructions, or these for OS X 10.8 or earlier.
    3. In the Energy Saver preference pane, uncheck the box marked
              Enable Power Nap while on battery power
    if it's shown (it may not be.)
    4. You can also try resetting the SMC.
    5. Make sure your system is up to date in Software Update.
    6. Make a "Genius" appointment at an Apple Store, or go to another authorized service center.

  • Running SSIS Using 32-Bit SQL Sqlserver 2012 implementation on a 64-Bit machine

    I created an SSIS job and I have installed 32-bit Sql Server, I use 32-bit MS Office Professional but my OS is 64-bit. The SSIS job wont run because the OLEDB connection gets errors because it's on this 64-bit machine. Can anyone assist n let me know how
    to configure?

    Hello,
    Please go through these helpful articles. I'm sure these would prove beneficial to you while running SQL Server Integration Services using 32-bit SQL Server 2012 implementation on a 64-bit environment.
    http://sqlblog.com/blogs/john_paul_cook/archive/2010/03/24/running-32-bit-ssis-in-a-64-bit-environment.aspx
    http://www.martinbour.com/code/post/Run-32-bit-SSIS-package-on-62-bit.aspx
    http://www.sqlhammer.com/blog/running-ssis-packages-in-32-bit/
    http://technet.microsoft.com/en-us/library/ms141766(v=sql.105).aspx
    If you find my post helpful please vote.
    Regards,
    Ankit Upadhyaya.

  • Want to make the sql insert run faster

    Hi,
    Need a small advice to make an insert statement of 7 million run faster.Currently taking 30min +.What is the difference between the following methods?which is the best method to adopt?
    1)Drop Table Single
    2)Create Table Single NoLogging
    As
    Select * From table1
    Union All
    Select * From table2
    Union All
    Select * From table3
    Union All
    3)Enable Constraints
    or
    1)Truncate table
    2)disable constraints
    3)INSERT /*+ APPEND */
    INTO table
    Select * From table1
    Union All
    Select * From table2
    Union All
    Select * From table3
    Union All
    4) Enable constraints
    Thanks

    Hi,
    >>What is the difference between the following methods?
    As far as I know direct-path load will bypass the buffer cache and will write directly to blocks within the tables you are loading. I'm no sure about CTAS method ...
    SQL> alter system flush shared_pool;
    System altered.
    SQL> alter system flush buffer_cache;
    System altered.
    SQL> set timing on
    SQL> create table tt1 nologging as select table_name from dba_tables;
    Table created.
    Elapsed: 00:00:36.59
    SQL> truncate table tt1;
    Table truncated.
    Elapsed: 00:00:00.23
    SQL> alter system flush shared_pool;
    System altered.
    Elapsed: 00:00:00.04
    SQL> alter system flush buffer_cache;
    System altered.
    Elapsed: 00:00:00.54
    SQL> insert /* +APPEND */ into tt1 nologging select table_name from dba_tables;
    23480 rows created.
    Elapsed: 00:00:02.89Cheers
    Legatti

  • I was wondring if there is any top free app for cleaning up  the computer and make it run faster while booting, on startup and while surfing web. I am using a macbookpro  with IOS10.8.5, under chrome,safari,firefox net environment. thanks on yourhelp

    I was wondering if there is any top free app for cleaning up  the computer from malware, phinishing apps, adware, and othere malicious softwares and make it run faster while booting, on startup and while surfing web. I am using a Macbook pro  with IOS10.8.5, under chrome,safari,firefox net environment. thanks on your help

    I was wondering if there is any top free app for cleaning up ...
    There is no such thing, since the problems you are describing can have various causes. Seeking anything claiming to "clean" your Mac is asking for trouble, since all of those products are scams, whether they are "free" or not.
    If you are having trouble with your Mac, describe what it is. Be as specific as possible. For general recommendations read below.
    There will always be threats to your information security associated with using any Internet - connected communications tool:
    You can mitigate those threats by following commonsense practices
    Delegating that responsibility to software is an ineffective defense
    Assuming that any product will protect you from those threats is a hazardous attitude that is likely to result in neglecting point #1 above.
    OS X already includes everything it needs to protect itself from viruses and malware. Keep it that way with software updates from Apple.
    A much better question is "how should I protect my Mac":
    Never install any product that claims to "clean up", "speed up", "optimize", "boost" or "accelerate" your Mac; to "wash" it, "tune" it, or to make it "shiny". Those claims are absurd.Such products are very aggressively marketed. They are all scams.
    Never install pirated or "cracked" software, software obtained from dubious websites, or other questionable sources.
    Illegally obtained software is almost certain to contain malware.
    "Questionable sources" include but are not limited to spontaneously appearing web pages or popups, download hosting sites such as C net dot com, Softonic dot com, Soft pedia dot com, Download dot com, Mac Update dot com, or any other site whose revenue is primarily derived from junk product advertisements.
    If you need to install software that isn't available from the Mac App Store, obtain it only from legitimate sources authorized by the software's developer.
    Don’t supply your password in response to a popup window requesting it, unless you know what it is and the reason your credentials are required.
    Don’t open email attachments from email addresses that you do not recognize, or click links contained in an email:
    Most of these are scams that direct you to fraudulent sites that attempt to convince you to disclose personal information.
    Such "phishing" attempts are the 21st century equivalent of a social exploit that has existed since the dawn of civilization. Don’t fall for it.
    Apple will never ask you to reveal personal information in an email. If you receive an unexpected email from Apple saying your account will be closed unless you take immediate action, just ignore it. If your iCloud, iTunes, or App Store account becomes disabled for valid reasons, you will know when you try to buy something or log in to this support site, and are unable to.
    Don’t install browser extensions unless you understand their purpose:Go to the Safari menu > Preferences > Extensions. If you see any extensions that you do not recognize or understand, simply click the Uninstall button and they will be gone.
    Don’t install Java unless you are certain that you need it:
    Java, a non-Apple product, is a potential vector for malware. If you are required to use Java, be mindful of that possibility.
    Java can be disabled in System Preferences.
    Despite its name JavaScript is unrelated to Java. No malware can infect your Mac through JavaScript. It’s OK to leave it enabled.
    The same precaution applies to Adobe Flash Player. Newly discovered Flash vulnerabilities appear almost weekly.
    Beware spontaneous popups: Safari menu > Preferences > Security > check "Block popup windows".
    Popup windows are useful and required for some websites, but unsolicited popups are commonly used to deceive people into installing unwanted software they would never intentionally install.
    Popups themselves cannot infect your Mac, but many contain resource-hungry code that will slow down Internet browsing.
    If you ever receive a popup window indicating that your Mac is infected with some ick or that you won some prize, it is 100% fraudulent. Ignore it.
    The same goes for a spontaneously appearing dialog insisting that you upgrade your video player right this instant. Such popups are frequently associated with sites that promise to deliver "free" movies or other copyrighted content that is not normally "free".
    The more insistent it is that you upgrade or install something, the more likely it is to be a scam. Close the window or tab and forget it.
    Ignore hyperventilating popular media outlets that thrive by promoting fear and discord with entertainment products arrogantly presented as "news". Learn what real threats actually exist and how to arm yourself against them:
    The most serious threat to your data security is phishing. Most of these attempts are pathetic and are easily recognized, but that hasn't stopped prominent public figures from recently succumbing to this age-old scam.
    OS X viruses do not exist, but intentionally malicious or poorly written code, created by either nefarious or inept individuals, is nothing new.
    Never install something without first knowing what it is, what it does, how it works, and how to get rid of it when you don’t want it any more.
    If you elect to use "anti-virus" software, familiarize yourself with its limitations and potential to cause adverse effects, and apply the principle immediately preceding this one.
    Most such utilities will only slow down and destabilize your Mac while they look for viruses that do not exist, conveying no benefit whatsoever - other than to make you "feel good" about security, when you should actually be exercising sound judgment, derived from accurate knowledge, based on verifiable facts.
    Do install updates from Apple as they become available. No one knows more about Macs and how to protect them than the company that builds them.
    Summary: Use common sense and caution when you use your Mac, just like you would in any social context. There is no product, utility, or magic talisman that can protect you from all the evils of mankind.

  • Does using secure disk erase make computer run faster?

    Does using the secure disk erase help mac book pro to run faster?

    No. That option should only be used for sensitive files; the Disk Utility's command for it is meant for secure deletion of files which were insecurely deleted or when the entire drive needs to be securely wiped.
    (68230)

  • HT1199 I have a 3.2 GHz Intel Core i3,  27 inch, Mid 2010. It used to run fast but now it seems to have slowed down like when surfing or opening applications. I downloaded all the updates restarted but it seem slow. How do I speed it up? Thanks

    I have a 3.2 GHz Intel Core i3,  27 inch, Mid 2010. It used to run fast but now it seems to have slowed down like when surfing or opening applications. I downloaded all the updates restarted but it still seem slow. How do I speed it up? Thanks - ManongCA

    Activity Monitor – Monitor Performance Problems  
    Why is my computer slow
    Why your Mac runs slower than it should
    Things you can do to resolve slowdowns  see post by Kappy

  • SQL Query C# Using Execution Plan Cache Without SP

    I have a situation where i am executing an SQL query thru c# code. I cannot use a stored procedure because the database is hosted by another company and i'm not allowed to create any new procedures. If i run my query on the sql mgmt studio the first time
    is approx 3 secs then every query after that is instant. My query is looking for date ranges and accounts. So if i loop thru accounts each one takes approx 3 secs in my code. If i close the program and run it again the accounts that originally took 3 secs
    now are instant in my code. So my conclusion was that it is using an execution plan that is cached. I cannot find how to make the execution plan run on non-stored procedure code. I have created a sqlcommand object with my queary and 3 params. I loop thru each
    one keeping the same command object and only changing the 3 params. It seems that each version with the different params are getting cached in the execution plans so they are now fast for that particular query. My question is how can i get sql to not do this
    by either loading the execution plan or by making sql think that my query is the same execution plan as the previous? I have found multiple questions on this that pertain to stored procedures but nothing i can find with direct text query code.
    Bob;
     

    I did the query running different accounts and different dates with instant results AFTER the very first query that took the expected 3 secs. I changed all 3 fields that i've got code for parameters for and it still remains instant in the mgmt studio but
    still remains slow in my code. I'm providing a sample of the base query i'm using.
    select i.Field1, i.Field2, 
    d.Field3  'Field3',
    ip.Field4 'Field4', 
    k.Field5 'Field5'
    from SampleDataTable1 i, 
    SampleDataTable2 k, 
    SampleDataTable3 ip,
    SampleDataTable4 d 
    where i.Field1 = k.Field1 and i.Field4 = ip.Field4 
    i.FieldDate between '<fromdate>' and  '<thrudate>' 
    and k.Field6 = <Account>
    Obviously the field names have been altered because the database is not mine but other then the actual names it is accurate. It works it just takes too long in code as described in the initial post. 
    My params setup during the init for the connection and the command.
    sqlCmd.Parameters.Add("@FromDate", SqlDbType.DateTime);
            sqlCmd.Parameters.Add("@ThruDate", SqlDbType.DateTime);
            sqlCmd.Parameters.Add("@Account", SqlDbType.Decimal);
    Each loop thru the code changes these 3 fields.
        sqlCommand.Parameters["@FromDate"].Value = dtFrom;
        sqlCommand.Parameters["@ThruDate"].Value = dtThru;
        sqlCommand.Parameters["@Account"].Value = sAccountNumber;
    SqlDataReader reader = sqlCommand.ExecuteReader();
            while (reader.Read())
                reader.Close();
    One thing i have noticed is that the account field is decimal(20,0) and by default the init i'm using defaults to decimal(10) so i'm going to change the init to 
       sqlCmd.Parameters["@Account"].Precision = 20;
       sqlCmd.Parameters["@Account"].Scale = 0;
    I don't believe this would change anything but at this point i'm ready to try anything to get the query running faster. 
    Bob;

  • Does the .rep report  run faster than the same program in .rdf format

    Hello,
         We have some reports timing out because they take too
    long to bring back results. If we used the .rep file instead of
    the .rdf file, will the reports run faster? Does it take very
    long to compile or is it most likely the SQL needs to be tuned
    for better performance?
    Thanks in Advance..
    Pmoore31

    No, the report will not run faster. It is most likely that you
    need to fine tune the SQL.

  • How can I load a .xlsx File into a SQL Server Table using a Foreach Loop Container in SSIS?

    I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
    I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
    If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
    Put the Data Flow Task within the Foreach Loop Container
    Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
    I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
    I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
    And that's when I run into trouble...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
    I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
    I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
    Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
    to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
    Thanks for your review and am hoping and praying for a reply and solution.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • My daughter locked her ipod touch and i cannot connect with itunes how do i fix this

    PLease help she's 8 years old and is driving me freakin nuts. I cannot get on itunes on my computer it does think im online if there is any other way besides itunes or having to go to the apple store please i need to know

  • Cant figure out how to sync my iphone

    Haven't synced my phone in a while and am trying to figure out how to do that. Also I'm trying to figure out how to find my apps through itunes/ icloud.

  • Posting accounting documents in G/L accounts.

    HI friends, what are the tables involved in posting accounting documents in G/L accounts. Please let me know. Thanks in advance. Roberts.K

  • Comma Without preceding colon Error in select query

    Hello Expert , can anyone tell me what is wrong with this query SELECT APARTYP APARTNER ABUKRS BNAME1 AEPAID BORT01 B~ORT02        BPFACH BPSTL2 BREGIO BSTRAS BLAND1 BTELFX        INTO(WA_ZDEF_RFS_COMPLY-PARTYP, WA_ZDEF_RFS_COMPLY-PARTNER, WA_ZDEF_RF

  • Simple question about code

    Hello, I am beginning with SQL again after a long break and am having a niggling problem with the following code. What is going wrong? Thanks, Jonathon Sunny CREATE TABLE CHILDREN CHILD_ID INT NOT NULL PRIMARY KEY, FNAME VARCHAR(24) NOT NULL, LNAME V