Count the number of characters as blocks within a string

How do i get the number of blocks
999999.9.999.99.99
This will be 5
999999.9.999.99
This will be 4

So count the numbers rather than the periods

Is there a simple way ?

Yes.

SELECT LEN(string) - LEN(REPLACE(string, '.', '')) + 1

1 Like

Thank you...