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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Changing the backward slash in a URL

Author  Topic 

cronincoder
Yak Posting Veteran

56 Posts

Posted - 2006-02-08 : 11:04:57
I have declared and set a variable to a url (ex: http://www.mypics.com)

declare @mypics varchar(100)
set @mypics = 'http://www.mypics.com'


I am getting a picture location from the database to append to the @picurl.


select @picurl + photo_location
from photos


The problem here is that the photo_location is returning a location that has backslashes (ex: upload\photos\pic1.jpg) because they are being accessed from server directories.

So the result looks like:

http://www.mypics.com\upload\photos\pic1.jpg

Is there a function of some sort, or what can I do to take the photo_location value and change it to forward slashes (ex: upload/photos/pic1.jpg?


thank you

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-02-08 : 11:25:16
Select @picUrl + replace(photo_location,'\','/') from photos

Corey

Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..."
Go to Top of Page

cronincoder
Yak Posting Veteran

56 Posts

Posted - 2006-02-08 : 11:31:19
that's great. worked perfectly.

thanks corey.
Go to Top of Page
   

- Advertisement -