Sql Query- HELP!! (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


calmstorm -> Sql Query- HELP!! (6/26/2002 13:14:18)

Hi People

So the White Paper for file uploading and adding data to the DB is all good - but I' ve run into a snag.

I was running under a test web and have now moved to the physical web - but when i added data it has stored the path to the file like this
http://myweb.com/testweb/files/photo.jpg

I need to run a query that will change all the paths to
http://myweb.com/files/photo.jpg

please help me with the sql to do this.
I created in FP with webbots and do not have a version of ACCESS on my computer. I' d like to do it with a query via FP - is this possible???




rdouglass -> RE: Sql Query- HELP!! (6/26/2002 14:47:48)

A couple of ways maybe. Of course backup your db before doing any of this.

1. <% myNewField=Replace(myField," testweb" ," files" )%>

2. <% myNewField = " http://myweb.com/files" & Right(myField,(Len(myfield)-24)) ' ---24 characters up to the ' /' after ' testweb' ..

then you could loop thru the records something like:

for i - 1 to numberOfRecords
myNewField=Replace(myField," testweb" ," files" )
UPDATE DISTINCTROW myTable SET myField = myNewField WHERE RecordID = RecordID
next

Of course you' ll have to grab RecordID along the way, but I think you get the idea. Another way would be to use GETROWS but that is probably too complex for this one-time problem.

Hope it helps...




calmstorm -> RE: Sql Query- HELP!! (6/26/2002 16:48:16)

Thank you - i managed to get the problem sorted out.

I have posted a new thread for another question i have.
Does this forum require using the same thread for a different question or a new thread????





Spooky -> RE: Sql Query- HELP!! (6/27/2002 2:47:57)

If its sort of related, it is good to have some background info, otherwise start a new one :-)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0390625