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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 string manipulation

Author  Topic 

matrixr
Starting Member

26 Posts

Posted - 2006-02-02 : 02:33:33
i have a table with a list of urls, they look like this

/Programming/CSharp/Default.aspx
/Programming/CSharp/Intro.aspx
/Programming/HowTo/Default.aspx
/Store/Default.aspx

what i want to do is get an output similar to this

Programming/CSharp
Programming/HowTo
Store

all i got so far is SUBSTRING(Url, 2, LEN(Url)) which returns Programming/CSharp/Default.aspx

any ideas?

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-02 : 02:39:29
[code]select substring(url, 2, len(url) - charindex('/', reverse(url)) - 1)
from
(
select '/Programming/CSharp/Default.aspx' as url union all
select '/Programming/CSharp/Intro.aspx' union all
select '/Programming/HowTo/Default.aspx' union all
select '/Store/Default.aspx'
) as urls[/code]

----------------------------------
'KH'


Go to Top of Page

matrixr
Starting Member

26 Posts

Posted - 2006-02-02 : 02:46:37
wow amazing

thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-02 : 03:32:26
Also in ASP file system object, you can make use of AbsolutePath feature

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -