0

如果我有这两个复杂的查询字符串

 ALM_frmTopAlarmHistoryReport.aspx?strAlarmConnection=AlarmSystem

 http://1.1.4.1/xyz/ALM_frmAlarmHistoryReport.aspx?ViewPDF=
 1&dtmStartDate={0}&dtmEndDate={1}& + '&lngAlarmGroup=' + 
 $('#ddlAlarmGroup').val() + '&lngProcessor=' + $('#ddlProcessor').val() + 
 '&intCategory=' + $('#ddlCategory').val()

我怎样才能执行select WHERE LIKE我尝试过的条件

 SELECT * FROM [tablename] WHERE string1 LIKE '%string2%' 

我收到以下错误

   Msg 103, Level 15, State 4, Line 1
   The identifier that starts with'%string2 ' is too long. Maximum length is 128.

任何帮助都将非常受欢迎,在此先感谢

4

1 回答 1

1

使用 locate 或 instr 代替:

select *
from tablename
where instr(string2, string1)  > 0
于 2012-07-24T15:41:32.933 回答