Forum Replies Created

Viewing 15 posts - 31 through 45 (of 50 total)

  • RE: Performance increase when qualifying join types

    Thanks Scott,

    The problem is that I think there is nothing wrong with my statement. The base function returns keys and dates. It is quite complex but performs very...

  • RE: CTE and UNION performance issue

    Chris,
    Dates are not consecutive. This script transform transactional data into a register. Initial data is contained in two different tables. One contains percentages while the other contains values that will be used to calculate percentages....

  • RE: CTE and UNION performance issue

    Thanks Luis, I replaced:

    SELECT HolderID, EffectiveDate, VotePercentage FROM Q1
    UNION ALL
    SELECT HolderID, EndDate, 0 FROM Q1

    with:

    SELECT L.HolderID, C.EffectiveDate, C.VotePercentage
    FROM Q1 L
    CROSS APPLY (VALUES (L.EffectiveDate, L.VotePercentage), (L.EndDate, 0)) C (EffectiveDate, VotePercentage)

  • RE: CTE and UNION performance issue

    Luis,

    I tried you statement (I put a TOP 5 to limit the results!) and it does not return StartDate and EndDate, it rather returns the StartDate twice. 

  • RE: Performance issue with EXCEPT

    I just found out a magic key. If I change the end of the first script from:

    SELECT * FROM OLD
    EXCEPT
    SELECT * FROM NEW;

    To:

  • RE: Performance issue with EXCEPT

    Thanks Jacob,

    Both old functions and new functions are iTVFs (new functions use CTE). I could send you the plans which are actually complex since the functions are themselves complex....

  • RE: WITH INDEX hint

    I did update the stats while my statement was oversimplified and it had a positive effect. But with my original statement, the performance remained poor.

  • RE: Performance issue when testing the value of ROW_NUMBER in a WHERE clause

    The plans are quite similar.

    The more I am analyzing this, the more it appears to be a SQL Manager Studio issue. I just discovered that if, within Manager Studio, I...

  • RE: Getting rid of cursors

    I edited and added the comma. Sorry. Current result is

    EffectiveDateHolderHQuantityTQuantityPercentage

    2001-01-01John 10 10 100

    2001-01-02John ...

  • RE: Getting rid of cursors

    J Livingston SQL,

    My real data is more complex than the sample data I post with my examples. In the first example you referred to, quantity was the actual sum of...

  • RE: Getting rid of cursors

    Drew,

    Sorry, you're right. I over-simplified thinking it would help. Here's something bigger:

    INSERT INTO @Transactions (EffectiveDate, Holder, Quantity) VALUES

    ( '2001-01-01', 'John', 5 ),

    ( '2001-01-01', 'John', 5 ), --John Holds 100%...

  • RE: Getting rid of cursors

    Everything needed is there in [font="Courier New"]courier new[/font]!

  • RE: Transform transactions into report without using cursors

    With the given dataset your solution gives the exact same result. With different datasets I sometimes get slightly different results but I am fixing it as I am learning new...

  • RE: Transform transactions into report without using cursors

    I have 2014 installed on my local computer. My clients have 2008 and up. If the right solution requires some clients to upgrade then it will be done! Thanks.

  • RE: Running totals on different columns

    The sample actually includes this case. John has 2 transactions as of 2001-01-01.

Viewing 15 posts - 31 through 45 (of 50 total)