This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / SQL Server中, 如何表达一个字母后面有若干个数字的pattern?
-tonyhao(tonyhao);
2010-1-13
(#5802335@0)
-
再具体点
-ssy214(寸草);
2010-1-13
(#5802378@0)
-
比如, T1, T12, T123, T1234, T12346789都是这种模式的。一个字母后面跟若干个数字
-tonyhao(tonyhao);
2010-1-13
(#5802862@0)
-
ISNUMERIC(right(len(col) -1) ?
-youbet(寻常巷陌);
2010-1-13
(#5802997@0)
-
主要是想用patindex
-tonyhao(tonyhao);
2010-1-14
(#5805220@0)
-
The pattern is simple. So it’s easy to use SQL query achieve it, e.g. WHERE Field like ‘T%’ AND ISNUMERIC(SUBSTRING(Field,2, LEN(Field)-1) ) =1However, if it’s complex pattern, it’s better to use Regular Expressions. Although SQL server doesn’t have built-in function or stored procedure of Regular Expressions, it’s easy to create UDF or SP by Regular Expressions of managed code.
-deep_blue(BLUE);
2010-1-15
{242}
(#5806606@0)
-
还是你比较厉害。
-tonyhao(tonyhao);
2010-1-15
(#5809113@0)