Single quotation mark nesting in SQL statements (direct nesting must be avoided) and SQL nesting
In SQL statements, we will inevitably use single quotes for nesting, but direct Nesting is definitely not acceptable. In java, it is also impossible to use backslashes for escape characters, in SQL, single quotes are used as escape characters.
For example, the following example shows the statement examples in the Stored Procedure query.
Exec cndoup_getpageofrecords @ pagesize = 10, @ currentpage = 1, @ columns = '*', @ tablename = 'room ', @ condition = 'roomtypelike' % standard ROOM % '', @ asccolumn = 'roomid', @ bitordertype = 1, @ pkcolumn = 'roomid'
The red part reports an error. It should be written as @ condition = 'roomtypelike ''% standard room % '''. The blue part is not double quotation marks, but two single quotation marks.
Nested quotation marks in javascript
When splicing a JS string, the double quotation marks must be single quotation marks, and the single quotation marks must be double quotation marks. This loop! However, all double quotation marks are acceptable, that is, the double quotation marks in the double quotation marks must be escaped!
SQL statement string nesting
-- Use two quotation marks
1. exec sp_test 'where loginname = ''jay '''
2. create proc sp_test
(
@ Condition varchar (200)
)
As
Declare @ SQL varchar (2000)
Set @ SQL = 'select * from userinfo'
Set @ SQL = @ SQL + @ condition
Exec (@ SQL)
Wish helpful