You are here: Re: Splitting a filename out of a filepath « MsSQL Server « IT news, forums, messages
Re: Splitting a filename out of a filepath

Posted by ZeldorBlat on 11/18/05 21:22

I don't think they have a CHARINDEX that searches from the end of the
string. If you want to know the last position of a character within a
string, you can abuse the reverse() function like this:

len(filepath) - charindex('/', reverse(filepath)) + 1

That gives you the position of the last '/' in the string. Note that
this only works if you're searching for a single character (that is, it
won't work if you replace the '/' with some arbitrary string with
length > 1). Also, if there is no '/' in the string, this guy will
return len(filename) + 1 as opposed to the normal charindex() which
returns 0 if the needle isn't found.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация