SQL Repeating Character String

后端 未结 2 1382
旧时难觅i
旧时难觅i 2021-01-27 08:34

Is there a way to evaluate a field if it has repeating values in a cell. For example if someone holds down a number key and it returns some variation of \'00000\' or \'222222222

2条回答
  •  庸人自扰
    2021-01-27 08:53

    As you are only interested in complete repeatings, such as '3333' and not in, say, '43333', this is rather simple: Find strings longer than one character, where you end up with an empty string when you remove all characters that equal the first one:

    select *
    from mytable 
    where len(value) > 1 and len(replace(value, left(value,1), '')) = 0
    

提交回复
热议问题