• Thanks Jeff Moden, I'm your fan in this forum.

    By the way, what you've posted isn't a stored procedure. It's just a script

    You wrote this Stored Procedure in one of your articles:

    SELECT @MyCount = @@ROWCOUNT

    SELECT CASE

    WHEN COUNT(hi.RowNum) + 1 = @MyCount

    THEN 'Account Running Total Calculations are correct'

    ELSE 'There are some errors in the Account Running Totals'

    END

    I was confused why first SELECT statement don't show @MyCount in output.

    Because I have a programming background, and I thought SELECT is equal to RETURN.

    In other programming languages if you have this code:

    int x;

    Return x = 10;

    Of course Return don't populating x with 10 😉

    But now I understand it isn't a stored procedure. It's just a script.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.