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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-02-21 : 07:44:08
|
Mike writes "I have a dbase with an about us field (is full url) and contactinfo field (part of a url) and want to combine the result but remove only the second part of the about us field (i.e. the 'profile.html' in the middle part of the combined result shown below):SELECT _aboutus_url +_contactinfo_htmlFROM database.dbo._LINKSResult:http://abc.com/profile.html/contactinfo.htmlhttp://xyz.com/profile.html/contactinfo.htmlAny help is much appreciated!" |
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2007-02-21 : 08:24:03
|
[code]DECLARE @about_us VARCHAR(255)DECLARE @contact VARCHAR(255)SET @about_us = 'www.abc.com/profile.html'SET @contact = 'contactinfo.html'SELECT LEFT(@about_us, PATINDEX('%/%.html%', @about_us)) + @contact [/code]This relies up _aboutus_url ending in '.html'.Mark |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-21 : 08:47:54
|
Something similar to thisSELECT LEFT(AboutUs, LEN(AboutUs) - 12) + ContactInfoFROM Database.dbo.LinksPeter LarssonHelsingborg, Sweden |
|
|
|
|
|