Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change a subset from a table

Author  Topic 

tmccar
Starting Member

27 Posts

Posted - 2012-07-04 : 09:17:58
I would like to manipulate a subset of a table called "users". I want to change the email domain of only those user records that have "cjj.com" as their domain", and change that to "ck1.org".
Here is my sql code:

update users
(select email from users where email like '%cjj.com')

Set email = replace(email, 'cjj.com', 'ck1.org');

But it's not working - please advice.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-07-04 : 09:21:01
update users
Set email = replace(email, 'cjj.com', 'ck1.org')
where email like '%cjj.com'



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

tmccar
Starting Member

27 Posts

Posted - 2012-07-04 : 09:30:00
That's great, thanks
Go to Top of Page
   

- Advertisement -