I needed to count the number of periods in a nvarchar column and, as usual, there is no specific help in SQL’s string library. I don’t want to go the CLR route as it’s a maintenance script and can’t add CLR components. So here comes a bit of SQL gymnastics…or hack if you will…
LEN(column)-LEN(REPLACE(column,’.’,”))
LEN(column)-LEN(REPLACE(column,’.’,”))