[英]SQL select where like using query string
如果我有這兩個復雜的查詢字符串
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.
任何幫助將非常受歡迎,謝謝
使用locate或instr代替:
select *
from tablename
where instr(string2, string1) > 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.