5
Answers

Incorrect syntax near the keyword 'FROM'. in sp

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)