Reputation: 21
I have a table in Teradata. This table has a column named text_column that contains some text in format varchar(25).
I need to count the number of ',' in this column.
Upvotes: 0
Views: 351
Reputation: 1270783
One method uses the difference of lengths of strings:
select ( character_length(text_column) - character_length(oreplace(text_column, ',', '')) as num_columns
Upvotes: 1