How to display numbers that are similar to 11111 or similar in MS sql
I am trying to display numbers from an ID column that should have the same number.
Like 11111 or 2222 or 33333
select * from table where id like '1111'
- this will give me 1 value, but there are many values like 1111111111 or 111111 that I am not sure about as there are over 100k entries.
+3
source to share
4 answers
If the numbers must match the first, you can write the first digit and then use the backreference:
^([0-9])\1+$
This will work if you have LIB_MYSQLUDF_PREG installed , which imports the PCRE library (according to Regular-expressions.info ). And the syntax will be PREG_RLIKE('/^([0-9])\\1+$/i', col)
.
+1
source to share