<P>有这样的一个存储过程</P> <P>CREATE PROCEDURE SelectProblem <BR>@n int,<BR>@sectionID int<BR>AS<BR>declare @i int<BR>set @i=0<BR>while @i<@n<BR>begin<BR>insert into PaperDetail (TitleID) values ('exec('select top '+cast(@n as varchar)+' [ID] from problem where sectionid='+cast(@sectionID as varchar)+' order by newid()')')<BR>set @i=@i+1<BR>end<BR>GO</P> <P>在inset(TitleID) 是取不到 那个随机产生的 [ID] 就是插不进去 ,这该怎么办拉</P> <P>恳请广大博友解答一下,小弟不胜感激!</P> <P> </P>
2 回答
慕婉清6462132
TA贡献1804条经验 获得超2个赞
insert into PaperDetail (TitleID) values ('exec('select top '+cast(@n as varchar)+' [ID] from problem where sectionid='+cast(@sectionID as varchar)+' order by newid()')') 说实话这句本身有错误,太复杂了,你就直说是什么目的吧,也许有简单的实现方法。
- 2 回答
- 0 关注
- 590 浏览
添加回答
举报
0/150
提交
取消