Sujeet Raman

Sujeet Raman

  • 793
  • 915
  • 330.6k

Incorrect syntax near the keyword 'FROM'. in sp

Aug 31 2020 12:56 PM
my sp returning the error 
Msg 156, Level 15, State 1, Line 13
Incorrect syntax near the keyword 'FROM'.
 
all from key word i have checked and its fine.why this issue is coming .If i remove below code,its working what error in this query?
 
set @selectcondition ='SELECT '+CONVERT(VARCHAR(10),@id1) + '= id1, '+@id2+' = id2,'+ @FieldName+' = FieldName, '+@Description+' = Description,'+ CONVERT(VARCHAR(10),@id3) +' = id3  FROM '+ @MessageOutput+ 'WHERE ID = '+ CONVERT(VARCHAR(10),@result)
EXEC (@selectcondition)
 

Answers (5)