[英]How do I do a SQL query that finds numbers in a field that is only 6 characters long and starts with the number 5?
請參見以下代碼:
select no_
from dbo.customer
where no_ like '5%%%%%'
采用:
select no_ from dbo.customer where no_ like '5_____'
LIKE運算符可識別兩個通配符:
好吧,你會這樣做:
select no_ from dbo.customer where no_ like '5%'
%
是通配符,可匹配任意數量的字符,包括無字符。
如果您也想保證6個字符:
select no_ from dbo.customer where no_ like '5_____'
_
是一個完全匹配一個字符的通配符。
我也將添加數字
select no_ from dbo.customer where no_ like '5_____' and ISNUMERIC(no_) = 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.