在一個表中我有一個入口與SQL服務器空間
12-345678
123-456-789
123456789
在UI的文本框,當有人類型的搜索: - (two spaces then one dash).
輸出應該是:
12-345678
在UI文本框,當有人類型時:12-
輸出應爲:
12-345678
在UI的文本框,當有人類型:12
12-345678
123-456-789
123456789
我選擇查詢要做到這一點的
select column1,column2 from table1 where column1 like '%textbox1.text%';
textbox1.text->文本框的名字UI。需要返回,爲前 -
任何事情之前:
if you type 12-, return output should be 12-345678 alone,
if you type 123-, then the return output should be 123-456-789 alone.
if you type - (only dash, no space on the front , then the return output should be 12-345678 and 123-456-789 .
然而,在一些條件下發生故障,有沒有什麼辦法可以計算出空間和SQL直接修改查詢?
你說兩個空格和破折號建議立即進行刪除返回12-345678,因爲它是唯一一個在3號字符是幾許? – 2012-08-08 21:39:37
之前的任何事情 - 需要返回,例如:如果您鍵入12-,則返回輸出應該是12-345678,如果您鍵入123-,則返回輸出應該是123-456-789。 – Sharpeye500 2012-08-08 21:41:04