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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-10-13 : 08:03:02
|
| raja writes "HI in my backend(sqlserver2000) i have a column containing datas like asdf/asde/frfr/mmm.aspx here could any one tell me how can i fetch that mmm.aspx only by using sql queriesraja" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-10-13 : 08:05:03
|
| SELECT Reverse(Substring(Reverse(col1), 1, CharIndex('/', Reverse(col1))-1)) FROM myTable |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2005-10-14 : 01:07:54
|
quote: Originally posted by robvolk SELECT Reverse(Substring(Reverse(col1), 1, CharIndex('/', Reverse(col1))-1)) FROM myTable
It's a good idea to do it like this:SELECT Reverse(Substring(Reverse(col1), 1, CharIndex('/', Reverse('/' + col1))-1)) FROM myTable...so you don't get errors or odd results when your original string does not contain a '/' character. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-14 : 01:17:51
|
blindman, Nice to see you at SQLTeam MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|