Avatar of Wigging
Wigging
Flag for United States of America asked on

mass update

lets per say that I have a table called   "data"  and inside that table i have a column called " description"

and inside description there is data like  "my website name is www.cholo.com"

and i would like to update  everything that contains  www.cholo.com   change to  www.peru.com ???
Microsoft SQL Server

Avatar of undefined
Last Comment
Anthony Perkins

8/22/2022 - Mon
Vaulden

You are looking for the UPDATE statement I believe. This should help you out

http://www.techonthenet.com/sql/update.php
ASKER CERTIFIED SOLUTION
Habib Pourfard

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Ron Malmstead

To clarify...

If the URL field doesn't contain anything except 'www.cholo.com' then you don't need to use the Replace function..or the %LIKE% in the Where clause, because that would unnecesarily add "cost".

Otherwise Mathewspatricks solution looks good to me.
lcohan

Just to add another twist into the pot... (because I was hit by this on SQL 2000 and 2005)

If the column data type is ntext (or even text) and your table is huge (I had 250million rows) you may find it faster to export all data out into a file (just row id and that ntext column), do the replace in that file using a free utility like below (don't look at its name - bad choice I guess...) then put it back into SQL.

http://sourceforge.net/projects/fart-it/
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Anthony Perkins

If the column data type is ntext (or even text) and your table is huge (I had 250million rows)
If it is text or ntext than they will not be able to use REPLACE on those columns.  At least not without converting them...