The following describes how to obtain the number of occurrences of a long string in SQL, if you need a friend, you can refer to the SQL to obtain a long string in the number of occurrences of a string implementation method such as a string: X-BGS-2010-09-15-001 I want to know where-the number of occurrences, you can use the following method
The following describes how to obtain the number of occurrences of a long string in SQL, if you need a friend, you can refer to the SQL to obtain a long string in the number of occurrences of a string implementation method such as a string: X-BGS-2010-09-15-001 I want to know the number of occurrences, you can use the following method
The following describes how to obtain the number of occurrences of a long string in SQL. For more information, see
How to obtain the number of occurrences of a long string in SQL
For example, there is a string:
X-BGS-2010-09-15-001
I want to know the number of occurrences of '-', which can be implemented using the following method without complex one-Character Analysis.
Declare @ a varchar (100)
Set @ a = 'x-BGS-2010-09-15-001'
Select len (replace (@ a, '-', '--')-len (@)
To put it simply, if you want to determine the number of letters c in field B in Table a, you can write
Select len (replace (B, 'C', '--')-len (B) from a. Of course, the len function may vary with different databases.