mysql - How to put single quotes around variables in a dynamic query -
I am trying to create a dynamic query. Initially, the query query is set to string and then I want to add the WHERE clause dynamically. This works, except that in this case the single quotes around the string are not @valval due to an error.
SET @Query = @Query + 'WHERE' + How do I include a single quotation mark, so that it can be added correctly? '' + Palalam + '' + operator + '+' '+ @val +';;
Thanks!
You must keep a quote between quotes but avoid, so it can not break your code. This will look like the following:
SET @Query = @Query + 'WHERE' + '' @param + '+ @operator +' '+' \ '+ + val +' \ ' '; Edit P>
Comments
Post a Comment