create proc paperbuild @papername char(200), @subject char(50), @xzt int,@xztn int,@tkt int,@tktn int,@pdt int,@pdtn int,
@wdt int,@wdtn int as
/*选择题生成部分*/
declare @bxzt int
declare @tempsql varchar(1000),@re int
set @bxzt=@xzt/2
select @bxzt
set @tempsql= 'insert into paper(question1,q_type,right_answer,option1,difficulty) select top '+str(@bxzt)+' question1,q_type,right_answer,option1,difficulty from question where q_type=''选择题'' and subject='''+@subject+''''
execute(@tempsql)
set @tempsql='update paper set papername='''+@papername+''' where papername is null'
execute(@tempsql)
select @tempsql
declare @lxzt int,@lsnd int
set @lxzt=@xzt-@bxzt
set @tempsql='select '+str(@re)+'=count(papername) from paper where papername='''+@papername+''''
exec sp_executesql @tempsql,N'@re int out',@re out
set @lsnd=@re
if @lsnd>@xztn
select 'da'
else
select 'xiao'
go
这个是我存储过程的全部内容了
各位帮忙看看
错误就是上面写的那个