2012年3月22日星期四

Full text search and replace

Need to search through a database and remove references to a company from
it. Grrr!
How can I do this? Do I need to write a client script to load each offending
record, or can I do it with SQL?
Conceptually I want to do
REPLACE IN Resumes TEXT 'Company Name' WITH ''
This is a full text table.
whats the best approach?
I'd try something like this:
declare @.replacement varchar(200)
set @.replacement='test'
update testtext
set textcol=
substring(textcol,1, patindex('%company%',textcol)-1)
+@.replacement +
substring(textcol,patindex('%company%',textcol)+le n('company'),datalength(te
xtcol)-patindex('%company%',textcol)+len('company'))
from testtext
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Andy Gilman" <andygilman2@.hotmail.com> wrote in message
news:utvmJQubEHA.904@.TK2MSFTNGP09.phx.gbl...
> Need to search through a database and remove references to a company from
> it. Grrr!
> How can I do this? Do I need to write a client script to load each
offending
> record, or can I do it with SQL?
> Conceptually I want to do
> REPLACE IN Resumes TEXT 'Company Name' WITH ''
> This is a full text table.
> whats the best approach?
>

没有评论:

发表评论