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 |
|
raisor
Starting Member
28 Posts |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-05-22 : 11:53:23
|
| declare @url varchar(255)set @url = 'http://www.democraticunderground.com/discuss/duboard.php?az=show_topics&forum=104'select left(@url,charindex('/',substring(@url,8,255) + '/') + 6)Result:http://www.democraticunderground.comSearches for first / after initial 6 characters (http://) and returns charactes up to that /If your url's start with something other than http:// (https://, ftp:// or others) this would have to be done differently. |
 |
|
|
raisor
Starting Member
28 Posts |
Posted - 2004-05-22 : 14:02:16
|
| THANKS!!!!!!, works freaking greatGeeez, now you just made me realize indeed about the https:// and ftp and RM streams over rtps (ow actually, that one would works :S)any hints please :D |
 |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-05-22 : 14:54:34
|
| Try this:declare @url varchar(255)set @url = 'http://www.democraticunderground.com/discuss/duboard.php?az=show_topics&forum=104'select left(@url,charindex('//',@url)+1) + left(substring(@url + '/',charindex('//',@url+'/') + 2,255),charindex('/',substring(@url+'/',charindex('//',@url+'/') + 2,255)) -1)That will work for anything containing <any characters>//<any characters> |
 |
|
|
raisor
Starting Member
28 Posts |
Posted - 2004-05-23 : 04:31:39
|
| Thank you very much for your help, I'm going to try it out in a bit!, this is great! |
 |
|
|
|
|
|
|
|