View Single Post
  #2 (permalink)  
Old 10-08-2006, 07:00 AM
Dimitar
 
Posts: n/a
Default MS SQL answer. Re: How do I implement LastIndexOf functionality in SQLServer 2000?

[sql]
select case when charindex('12',s) =0 then 0 else length(s)-charindex(reverse('12'),reverse(s)) end as lastIndexOf, s from t;
[/sql]
The above was not tested.
The above finds the last index of '12' in column 's' of table 't'.
Hope this helps.
Edit/Delete Message Reply With Quote