次のエラーが表示されます。
メッセージ 203、レベル 16、状態 2、プロシージャ getQuestion、行 18
The name 'select top(1) * from tlb_Question inner join tlb_options on tlb_options.qID=tlb_Question.id and tlb_Question.qNumber=1 and tlb_Question.id not in (0 ,1)' は有効な識別子ではありません
次のストアド プロシージャから:
ALTER proc getQuestion
@qNo bigint,
@total bigint,
@next nvarchar(max)
as
begin
declare @hisa bigint
set @hisa=@total/3
if(@qNo<=@total/3)
begin
declare @query nvarchar(max)
set @query=('select top(1) * from tlb_Question
inner join tlb_options on tlb_options.qID=tlb_Question.id and tlb_Question.qNumber=1 and tlb_Question.id not in ('+cast(@next as varchar)+')')
print @query
execute @query
end
end