It seems that defining your procedure is this. It would be easier to help here if you posted the definition.
create procedure MyProc
(
@NumRows int = 0
)
as
if @NumRows > 0
set rowcount @NumRows
else
set rowcount 0
select Columns
from Table
Assuming the definition is similar to above, you can change it to something like this.
create procedure MyProc
(
@NumRows int = 2147483648
)
as
select top(@NumRows) Columns
from Table
Please note that when using TOP you need to indicate the order or you do not know which rows will be returned.
- EDIT -
. , . IF , . , lad2025.
select top(isnull(nullif(@NumRows, 0), 2147483647)) Columns
from Table