Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Char occurence in a string
Message
From
29/01/2003 15:05:59
 
 
To
29/01/2003 14:45:54
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00746848
Message ID:
00746855
Views:
17
This message has been marked as the solution to the initial question of the thread.
There's a slick little trick:

LEN(REPLACE(string, '-', '--')) - LEN(string)

-Mike

>Hi,
>
>I would like to find out how many times the
>- appears in a string....
>
>Is there an efficient way to find this out.
>
>Therefore,
>
>my string could be.
>
>C-X-AB1515-02-01
>
>
>I want to find out the number of times the - appears in the string.
>
>Thanks,
>
>a
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform