I found the problem when I used SQL Server to query the table name starting with PRM _, check whether the underline is not escaped, I would like to summarize the T-SQL character escape
Create a temporary table and insert sample data
1 Create Table # Characters (CH Varchar ( 200 )) 2 Insert # Characters Values ( ' [Start time ]: ' ) 3 Insert # Characters Values ( ' Prm_batch ' ) 4 Insert # Characters Values ( ' Select promisetime '' Ptime ''' ) 5 Insert # Characters Values ( ' 4% 2 = 0 ' ) 6 Insert # Characters Values ( ' 4/2 = 2 ' )
Escape Query
1 -- Escape with/and escape [] 2 Select * From # Characters Where Ch Like ' /[Start time/] % ' Escape ' / ' 3 -- For _ and %, escape [] 4 Select * From # Characters Where Ch Like ' PRM [_] % ' 5 Select * From # Characters Where Ch Like ' 4 [%] % ' 6 -- For single quotes, add single quotes to escape 7 Select * From # Characters Where Ch Like ' Select promisetime '' % ' 8 -- No escape is required /. 9 Select * From # Characters Where Ch Like ' 4/% '