SQL选择使用查询字符串的位置

时间:2012-07-24 15:37:48

标签: mysql sql

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

 ALM_frmTopAlarmHistoryReport.aspx?strAlarmConnection=AlarmSystem

AND

 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.

提前感谢任何帮助

1 个答案:

答案 0 :(得分:1)

改为使用locate或instr:

select *
from tablename
where instr(string2, string1)  > 0
相关问题