QA and SP - different resutls

  • I have Stored procedure and after running it i am getting different results as when i run from Query Analyzer.

    I have found that the problematic part can be part with the second cursor.

    any general thoughts?

  • alstar (3/2/2009)


    any general thoughts?

    Without seeing the code, no.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ok i think i have found the problem but i need confirmation from you guys.

    UPDATE #temp set BasketCost=0 WHERE DeliveryChargeID = @LinkedUserDeliveryChargeID

    this code set BasketCost to 0 in SP, but not in QA.

    Both values are NULL

    QA did correct job when was comparing NULL = NULL, and didnt set BasketCost to 0, but SP did as it executed NULL = NULL as true...

    what should I do? use `LIKE` instead of `=` ?

    or maybe .... WHERE DeliveryChargeID = @LinkedUserDeliveryChargeID AND LinkedUserDeliveryChargeID IS NOT NULL....

  • alstar (3/2/2009)


    so my question is, QA did correct job when was comparing NULL = NULL, and didnt set BasketCost to 0, but SP did as it executed NULL = NULL as true...

    Check the ANSI_NULL settings.

    As for which is right, only you can answer that one. Like behaves the same as = with regard to nulls

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • WHERE (a ISNULL AND b ISNULL)

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • WHERE (a IS NULL AND b IS NULL)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (3/4/2009)


    Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:

    Sleep, yes good it would be.

  • Jeff Moden (3/4/2009)


    Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:

    Howcanyouforgetthespaces?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (3/4/2009)


    Jeff Moden (3/4/2009)


    Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:

    Howcanyouforgetthespaces?

    heh.BecauseAllMyVariablesAndColumnNamesAreMixedCaseAndItsBecomeAHabit. 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply