Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

SQL count of a specific character

Is there any way in SQL to count the number of characters, say hyphens '-' in a SQL field and store that in a variable?
0
zintech
Asked:
zintech
1 Solution
 
sdstuberCommented:
select len(yourstring) - len(replace(yourstring,'-',''))
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now