Skip to content

Instantly share code, notes, and snippets.

@morriekken
Created June 1, 2022 10:03
Show Gist options
  • Save morriekken/1a511cfed18c6bf49a8229f3c9298be4 to your computer and use it in GitHub Desktop.
Save morriekken/1a511cfed18c6bf49a8229f3c9298be4 to your computer and use it in GitHub Desktop.
SQL, Count characters (commas) in string
SELECT
LEN(col) - LEN(REPLACE(col, ',', '')) count_commas
FROM table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment