Nesting of single quotation marks in SQL statements


In SQL statements, we will inevitably use single quotation mark nesting, but direct nesting is certainly not OK. It is also not OK to use backslash as escape character in Java, and single quotation mark is used as escape character in SQL.

For example, the following example is an example of a query in a stored procedure

exec cndoup_ getpageofrecords @ pagesize=10,@currentpage=1 ,@columns= '*' ,@tablename= 'ROOM' ,@condition= 'roomtypelike'% standard room% ', @ asccolumn' ='roomid ', 

@bitordertype=1, @pkcolumn='ROOMID'

The red part will report an error. It should be written as @ condition =’roomtypelike ‘%% standard room%’, and the blue part is not double quotation marks, but two single quotation marks