商店程序不归还记录

商店程序不归还记录

本文介绍了商店程序不归还记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行此sp它不会返回值。



i am run this sp it will not return value.

alter PROCEDURE [USP_GetListOfQuestion]
	-- Add the parameters for the stored procedure here
	@TestPaperCode varchar
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	DECLARE @RowCount INT;
Select @RowCount = Count(*) from tbl_TestPaper where TestPaperCode = @TestPaperCode

Create table #Temp
(
QuestionId bigint
)


DECLARE @intFlag INT
SET @intFlag = 1
WHILE (@intFlag <=@RowCount)
BEGIN
--Change
DECLARE @NoOfQst INT;

select @NoOfQst =  max(NoOfQuestions ) from (SELECT Row_Number() OVER
 (ORDER
 BY
  TestPaperId) RoNo,* from tbl_TestPaper where TestPaperCode = @TestPaperCode) X
  where RoNo=@intFlag


Insert Into #Temp(QuestionId)
Select Questionid from (
Select top(@NoOfQst) Questionid as 'Questionid' from dbo.tbl_Questions a
inner join 
(SELECT Row_Number() OVER
 (ORDER
 BY
  TestPaperId) RoNo,* from tbl_TestPaper where TestPaperCode = @TestPaperCode) b 
on a.CategoryId=b.CategoryId and a.Marks=b.Marks

Where RoNo=@intFlag
ORDER BY NEWID())Y
--Change
print @intFlag
SET @intFlag = @intFlag + 1
END
    -- Insert statements for procedure here
Select * from #Temp

drop table #Temp

END
GO





请帮我,我正在使用NewID方法。



please help me i am using NewID method.

推荐答案



这篇关于商店程序不归还记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:14