Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-01-05 : 12:22:15
|
Hi, all,I am looking for some ways to return the last occurrence of a pattern in a specified expression. CharIndex gave me the first occurrence. For instance, I need to get the position of the last space in this string:'John E. Doe'Thanks! |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2007-01-05 : 13:32:44
|
[code]Declare @str varchar(32)Set @str = ' abc defghi j u'SELECT Len(@str) + 1 - CharIndex(' ', Reverse(@str))[/code] |
 |
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-01-05 : 13:45:32
|
Great, thanks! |
 |
|
|
|
|