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 |
|
RyanAustin
Yak Posting Veteran
50 Posts |
Posted - 2007-10-10 : 11:30:19
|
| Hello, I have a table that contains a list of all the websites and their paths that our companies developers have created and employees have visited populated from our IIS logs. I need to extract just the first level folder from this list and am lost as to how to do it. I use select distinct substring(csUriStem,charindex('/',csUriStem)+1,len(csUriStem)) from globaliislog and it removes the first / in the tables fine, but I now need to drop everything after the second /. Any suggestions would be appreciated. Thank you, Ryan |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-10-10 : 11:38:29
|
| you effectively repeat the exercise....using a derived table with the results of the 1st queryselect distinct(substring(pass1,1, charindex('/',pass1))) as pass2 from (select substring(csUriStem,charindex('/',csUriStem)+1,len(csUriStem)) as pass1 from globaliislog) a |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-10 : 11:45:05
|
| moved from script library_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
RyanAustin
Yak Posting Veteran
50 Posts |
Posted - 2007-10-10 : 12:01:07
|
| That is perfect. Thanks so much |
 |
|
|
|
|
|