在某个表随机抽取n条记录并写入另一张表,该怎么解决

在某个表随机抽取n条记录并写入另一张表

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[extract_b]

@tid int=NULL,   --考试号
@sum int=NULL,   --题目数量
@cpt1 int=NULL,  --章节范围1
@cpt2 int=NULL,  --章节范围2
@dif1 int=NULL,  --难度系数范围1
@dif2 int=NULL   --难度系数范围2

AS

BEGIN

SET NOCOUNT ON;

    select top (@sum) qChoice.qid into #tmptable from qChoice where qChoice.cpt>=@cpt1 and qChoice.cpt<=@cpt2 and qChoice.dif>=@dif1 and qChoice.dif<=@dif2 order by newid()

    insert into Paper select #tmptable.qid,0,@tid from #tmptable

    --删除临时表
    Drop Table #tmptable

END

Return @tid



如上所示我的存储过程是要在qChoice表随机抽取n条符合条件的记录,然后将某些字段写入另一张表Paper中。请问一下为何我把存储过程的参数换成实际的数字然后在查询器里面直接运行在Paper表是有记录写入的,而调用以上的存储过程就什么记录也没有呢?存储过程没报错,不用临时表也试过也是不行,where子句那里用between试过也不行。后来我去掉and qChoice.dif<=@dif2这句,就是说where子句只有3个and,然后我调用这个存储过程就可以了。有点懵了,难道说where子句还限制and的个数?求熟悉这个的哥哥姐姐们帮忙解答一下。
------解决方案--------------------
没有结果
就说明select 的条件部分不成立吧
qChoice.cpt>=@cpt1 and qChoice.cpt<=@cpt2 and (qChoice.dif>=@dif1
这样返回的记录里是否有
qChoice.dif<=@dif2 的?