最佳答案
@RowFrom int
@RowTo int
are both Global Input Params for the Stored Procedure, and since I am compiling the SQL query inside the Stored Procedure with T-SQL then using Exec(@sqlstatement)
at the end of the stored procedure to show the result, it gives me this error when I try to use the @RowFrom
or @RowTo
inside the @sqlstatement
variable that is executed.. it works fine otherwise.. please help.
"Must declare the scalar variable "@RowFrom"."
Also, I tried including the following in the @sqlstatement
variable:
'Declare @Rt int'
'SET @Rt = ' + @RowTo
but @RowTo
still doesn't pass its value to @Rt
and generates an error.