Must declare the scalar variable

前端 未结 8 1270
小蘑菇
小蘑菇 2020-11-29 01:41

@RowFrom int

@RowTo int

are both Global Input Params for the Stored Procedure, and since I am compiling the SQL query inside the St

8条回答
  •  失恋的感觉
    2020-11-29 02:13

    Just FYI, I know this is an old post, but depending on the database COLLATION settings you can get this error on a statement like this,

    SET @sql = @Sql + ' WHERE RowNum BETWEEN @RowFrom AND @RowTo;';
    

    if for example you typo the S in the

    SET @sql = @***S***ql 
    

    sorry to spin off the answers already posted here, but this is an actual instance of the error reported.

    Note also that the error will not display the capital S in the message, I am not sure why, but I think it is because the

    Set @sql =
    

    is on the left of the equal sign.

提交回复
热议问题