February 24, 2014 | Posted in: SQL Server

A nice and simple way to find the total instances of a specific char in a SQL varchar:

select (len(’1/2/3/4/5/6′) – len(replace(’1/2/3/4/5/6′, ‘/’, ”))) as char_count

Be the first to comment.

Leave a Reply


two × 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>