Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Il messaggio 203, livello 16, stato 2, non è un identificatore valido

Si prega di provare questo, modificato esegui @query per eseguire (@query):

ALTER proc getQuestion
    @qNo bigint,
    @total bigint,
    @next nvarchar(max)
as

begin 
    declare @hisa bigint
    set @[email protected]/3

    if(@qNo<[email protected]/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