Stored proc giving diff answers?

  • Hi I got a stored proc and it is giving funny answers. by this when i runn it as a sp i get one answer an if i run it as a batch in Qa I get another, (using 2000) can any one help.

    beloww is the statment:

    SELECT COUNT(*)

    FROM [allmatview]

    INNER JOIN [Usr_Global_Data_1]

    ON [allmatview] .entityref= [Usr_Global_Data_1] .EntityRef

    AND [allmatview] .number =[Usr_Global_Data_1] .MatterNO

    WHERE [allmatview].entityref IN ('ZUR000000000000', 'ZUR000000000002', 'ZUR000000000004')

    AND [Usr_Global_Data_1] .Recovery_FPA<> 'R'

    AND [Usr_Global_Data_1].Recovery_percentage =100

    AND( [Usr_Global_Data_1].File_Close_Date > '2002-05-07 00:00:00.00' OR [Usr_Global_Data_1].File_Close_Date = NULL)

  • Different how? Is the count being returned different? By how much?

    Can you post the code fro botht he batch and the sp so we can rule out user error?

    I do notice an error in this line:

    AND [Usr_Global_Data_1] .Recovery_FPA<> 'R'

    Notice the space before .Recovery_FPA?


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Also look at the last part of your WHERE clause. You should be using IS NULL instead of = NULL

Viewing 3 posts - 1 through 2 (of 2 total)

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