Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在“10jnklgm51”等字符串中查找最后一个非数字字符。为了在示例中找到“m”,最好的简单方法是什么?
最后一个非数字字符是反向字符串中的第一个非数字字符。所以,像这样:
select substring(reverse(str), patindex('%[^0-9]%', reverse(str)), 1)