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 |
shpinoza1980
Starting Member
17 Posts |
Posted - 2011-02-13 : 07:39:27
|
Hello,I have a nvarchar column called [url] with data like:http://google.news.........http://www.mysite.comFor every row I need to SPLIT the data on the second 'http://' so the update results for this column will be (for the row above)(get rid of the first http:// in the string)http://www.mysite.com thanks a lot |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-13 : 09:06:58
|
[code]select substring(url, charindex('http://', url, charindex('http://', url) + 1), len(url))[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-13 : 09:09:11
|
replace @a with the column name and check if works for your case!reverse(substring(reverse(@a),0,patindex('%//:ptth%',reverse(@a))+7)) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-14 : 05:42:30
|
ordeclare @s varchar(1000)set @s='http://google.news.........http://www.mysite.com'select right(@s,CHARINDEX('//:ptth',reverse(@s))+6)MadhivananFailing to plan is Planning to fail |
 |
|
shpinoza1980
Starting Member
17 Posts |
Posted - 2011-02-14 : 08:09:25
|
thanks all, I've used madhivanan solution, works greatthanks a lot |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-14 : 09:18:52
|
quote: Originally posted by shpinoza1980 thanks all, I've used madhivanan solution, works greatthanks a lot
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|