开发者

T-SQL LIKE regular expression

开发者 https://www.devze.com 2023-01-08 00:53 出处:网络
I\'m trying to select only entries in the following format from a varchar field. [Any number of zeros][a hyphen or not][any number of numbers]

I'm trying to select only entries in the following format from a varchar field.

[Any number of zeros][a hyphen or not][any number of numbers]

Some samples of what I want would be...

000000000007975
000000000-58628
123421423890347

But not:

00000--18945489
00开发者_Go百科000000000012B

SELECT Field<br>
FROM table<br>
WHERE Field LIKE ???


T-SQL does not support regular expressions. You could look into the CLR to add this.

http://www.simple-talk.com/sql/t-sql-programming/clr-assembly-regex-functions-for-sql-server-by-example/

0

精彩评论

暂无评论...
验证码 换一张
取 消