How can I concat string in dynamic sql?
I need to put the below SQL in Dynamic sql
Select ID ,Question, answer, (question + ':' + answer) as Question_Text from table
where question = @question
I've tried somthing like below but i keep getting an error?
Declare @sql varchar(max)
set @sql = 'Select ID ,Question, answer, (question + ''':''' + answer) as Question_Text from table where question = ' + @Question + ''
Exec @sql
Start Free Trial