Running the stored procedure more than once

  • Hi

    I have a stored procedure which calculates the leaves of employees.The only problem is i have to run the stored procedure more than once to make sure it has done the calculation for all the employees and then it gives me the correct results.

    the first time i run the stored proc, it says that 360 rows were generated.The next time i run it says that 80 rows were generated. the next time i run it says that 5 rows were generated.

    i wanted to know is there some SQL Setting which is limiting the number of rows being generated when a stored procedure runs.

    Thanks

  • To have a chance of answering this we should see example data and the code. Have a look at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for guidance on providing these.

    BrainDonor.

  • hmm thats quite interesting, or i would say some poor SQL logic ;-).

    Post the Stored Proc's script

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Can you please give me the sample code and sp query which you have written.

  • lijusmail (4/7/2010)


    i wanted to know is there some SQL Setting which is limiting the number of rows being generated when a stored procedure runs.

    SET ROWCOUNT can limit the number of rows being affected.

  • Without seeing code, who knows?

    Here's a guess: If it's an OLTP database maybe new records are being added or modified in between runs of the sproc and that's why the count is differing.

Viewing 6 posts - 1 through 5 (of 5 total)

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