Howto | mssql seach and replace?

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 58
Reputation: desiguru is an unknown quantity at this point 
Solved Threads: 1
desiguru desiguru is offline Offline
Junior Poster in Training

Howto | mssql seach and replace?

 
0
  #1
Nov 29th, 2006
In my database, I have two tables: Forum and Files

Files have two fields. First one is FileID and second one is FileAddress.

FileId field is fine. but in FileAddress field I have a lot of urls. I want to just change certain parts of url. For example, instead of having http://ipaddress/FILEPATH

I want to chage that to http://domain.com/FILEPATH for about 400 data in the sql table. How do I do this?????
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7
Reputation: RobStocks is an unknown quantity at this point 
Solved Threads: 0
RobStocks RobStocks is offline Offline
Newbie Poster

Re: Howto | mssql seach and replace?

 
0
  #2
Jan 15th, 2007
Originally Posted by desiguru View Post
In my database, I have two tables: Forum and Files

Files have two fields. First one is FileID and second one is FileAddress.

FileId field is fine. but in FileAddress field I have a lot of urls. I want to just change certain parts of url. For example, instead of having http://ipaddress/FILEPATH

I want to chage that to http://domain.com/FILEPATH for about 400 data in the sql table. How do I do this?????
Hi Desiguru,
You could use the stuff function e.g.
stuff( 'http://ipaddress/FILEPATH', 8, 9, 'domain.com')
this will replace from character 8 the 9 characters 'ipaddress' with 'domain.com'
but you would obviously replace the string to be modified with the field name

stuff( FileAddress, 8, 9, 'domain.com')

and you would obviously need to select the appropriate records

Regards

Rob
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 44
Reputation: MCP is an unknown quantity at this point 
Solved Threads: 3
MCP MCP is offline Offline
Light Poster

Re: Howto | mssql seach and replace?

 
0
  #3
Jan 16th, 2007
Also, look at the SUBSTITUTE function
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS SQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC