消息203,级别16,状态2,不是有效的标识符 [英] Msg 203, Level 16, State 2, is not a valid identifier
本文介绍了消息203,级别16,状态2,不是有效的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误:
消息203,级别16,状态2,过程getQuestion,第18行
名称'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) '不是以下存储过程的有效标识符
Msg 203, Level 16, State 2, Procedure getQuestion, Line 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)' is not a valid identifier
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
推荐答案
请尝试此操作,将execute @query更改为执行(@query):
Please try this, changed execute @query to execute (@query):
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
这篇关于消息203,级别16,状态2,不是有效的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文