• ssurekha2000 (6/12/2013)


    the whole sp cannot be posted as there are many joins

    to get the result & check i prepared 3 different SPs with conditions as stated above

    SP1 contains @dt1 & @dt2 date passed

    SP2 contains @dt3 & @dt4 date passed

    SP3 contains @dt1 & @dt2 & @dt3 & @dt4 date passed with where clause as stated by you

    when SP1 & SP2 are executed i get the proper results

    but if i executue the SP with case in where clause i get no records

    individually in SP1 i get 13 records

    SP2 i get 6 records

    Please post the whole query for SP3. Without it, we're guessing.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden