Link to home
Start Free TrialLog in
Avatar of ImInNeedOfHelp
ImInNeedOfHelp

asked on

BaseURL

Hi
Any one know how i can extract the baseurl from a table column and insert into another column.
i.e http://www.mysite.com/page1.aspx or http://mysite.com/page1.aspx looking to insert into a column in the same table http://www.maysite.com/ or http://mysite.com/
Thanks
George
Avatar of Aneesh
Aneesh
Flag of Canada image

SELECT LEFT(url, CHARINDEX('/',url, PATINDEX('%://%',url)+3))
Avatar of ImInNeedOfHelp
ImInNeedOfHelp

ASKER

Hi aneeshattingal:
I get this error when trying the following
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

------------------------------------

update dbo.sr_Images
set ImageBaseURL = (SELECT LEFT(imageurl, CHARINDEX('/',imageurl, PATINDEX('%://%',imageurl)+3))
from dbo.sr_Images)
Regards
George
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks aneeshattingal:
That work ok
Regards
George