我在SQL SERVER中写一个存储过程,在存储过程里我declare一个变量@toprecord,@toprecord指定需返回结果集的前若干条记录。
如:select top 5 * from table where ..... 返回前5条记录,现在我想自己确定返回若干条记录,我写了:select top @toprecord * from table where ..... 但是这句非法。
请问这个问题怎么解决?
...全文
491打赏收藏
还有请教大侠:有关TOP的应用。急急急请问
我在SQL SERVER中写一个存储过程,在存储过程里我declare一个变量@toprecord,@toprecord指定需返回结果集的前若干条记录。 如:select top 5 * from table where ..... 返回前5条记录,现在我想自己确定返回若干条记录,我写了:select top @toprecord * from table where ..... 但是这句非法。 请问这个问题怎么解决?