SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change a subset from a table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tmccar
Starting Member

Ireland
27 Posts

Posted - 07/04/2012 :  09:17:58  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Germany
8513 Posts

Posted - 07/04/2012 :  09:21:01  Show Profile  Visit webfred's Homepage  Reply with Quote
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

Ireland
27 Posts

Posted - 07/04/2012 :  09:30:00  Show Profile  Reply with Quote
That's great, thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000