• If you would really like some help with this, how about posting the DDL for the tables, some sample data for each of the tables, sample inputs for the procedure, and expected results for each of the inputs to the procedures.

    I am certain that you would get something better than you have right now. I have looked at the code but I'm not quite certain what you are actually wanting from the procedure. Are you looking for a page of data + the total number of rows possible?

    Plus, any changes I make to your code, I have nothing to test it against or to determine if it actually does what you expect. A little hard to help when there isn't enough to work with.