all groups > sql server full text search > december 2003 >
You're in the

sql server full text search

group:

Updating part of text string



Re: Updating part of text string John Kane
12/1/2003 11:10:58 AM
sql server full text search: Roar,
T-SQL REPLACE can do this. See SQL Server 2000 BOL title "REPLACE" -
syntax - "REPLACE ( 'string_expression1' , 'string_expression2' ,
'string_expression3' )"

A more complex example of doing a "search & replace" can be found at:
http://vyaskn.tripod.com/sql_server_search_and_replace.htm

Regards,
John



[quoted text, click to view]

Updating part of text string Roar Johnsen
12/1/2003 6:52:52 PM
Can anyone help me with the following problem:

I have a database with a column containing long text-values. Inside theese
textvalues there are som url's that I need to change, or atleast part of
them.

What I need is a SQL query which updates only part of the text-streng. The
url's point to an old internal web-server. The text streng http://afintra is
to be replaced with http://af-web-int.

I have managed to select the values containing the text string with the like
expression, but how do I update just this part of the value??

Hopefully this is like a piece of cake for some of you :-)

Re: Updating part of text string John Kane
12/1/2003 7:39:51 PM
You're welcome, Roar,
There are couple of options depending upon what you want to do. First of
all, review the following from MSDN (a copy of the BOL title) "Changing
ntext, text, or image Data" at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_md_04_6zec.asp

A quick search for "replace" and "search" with "SQL Server" using Google,
turned upped the following link:
http://www.tek-tips.com/gviewthread.cfm/lev2/4/lev3/27/pid/183/qid/666505
for someone who want do what I think you are doing... "Does anyone have a
script to replace a string within an nText field with another string for all
nText fields in a SQL Svr 2K database?" If this is not what you want, you
should be able to modify SP_REPLACEALLTEXT to fit your needs.

Regards,
John




[quoted text, click to view]

Re: Updating part of text string Roar Johnsen
12/1/2003 9:06:13 PM
Thanks for your replay John!

I've found this REPLACE function, but I don't understand how to use it.

If I'm right, I'm supposed to, somehow, replace the string_expression1 with
the data I wan't to change. I've tried to use a select function but It won't
work...

I also tried the "search & replace" routine, but it doesn't seem to scan the
text-columns.

Roar




[quoted text, click to view]

AddThis Social Bookmark Button