How to count # of occurrences of a character inside a string using SQL query?

In a delimited text file, quotation marks are a way of escaping non-standard characters. As a result, some system is seeing the quotation mark and assuming that everything until the next quotation mark is supposed to be one field. This behavior may result some records being skipped.

The following query find records with un-balanced quotation marks in a field.

Find sentences open with quotation marks and not closed.

SELECT *
FROM ADDRESS
WHERE COMPANY_NAME LIKE '%"%'
AND (LEN(COMPANY_NAME) - LEN(REPLACE(COMPANY_NAME,'"',''))) % 2 != 0