Is it possible, using pure SQL
to count the number of x
's in the following strings?
708258761XXXXXXXX00A
708232761XXXXXXXXXXA
result when ran against the previous strings being
8
10
I could easily do this in code, but I'm looking for a pure T-SQL
method for doing this.
The pattern will have varying numbers of X
's depending on the product I'm looking at.
Put another way, What I'm looking for is a pure SQL
way of counting the number of matches of a pattern.
In the above example, the input pattern is X
. Using another example, with a search pattern of Ted
the following could return a value of 3
:
Ted is Ted because Ted is awesome!