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
 Update email
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mmatthews0508
Starting Member

1 Posts

Posted - 08/01/2012 :  15:28:47  Show Profile  Reply with Quote
We recently had a company that is in our database change their email schema. I am trying to do this through SQL so that I do not have to do all 200+ by hand. I need the domain to change, as well as making it lastname.firstname@newdomain.com

I have the following

UPDATE Name

SET name.EMAIL=REPLACE(dbo.name.email,'%@olddomain.com', '@newdomain.com')

So I can update the domain, but how do I make it read in the data for last name and first name and insert prior to the @newdomain.com?

Thanks in advance!

webfred
Flowing Fount of Yak Knowledge

Germany
8514 Posts

Posted - 08/01/2012 :  15:36:40  Show Profile  Visit webfred's Homepage  Reply with Quote
So what you have is:
- the part '@newdomain.com'
- a column with lastname
- a column with firstname
then you can create that new mailaddress by concatenating the parts.
EMAIL=lastname+'.'+firstname+'@newdomain.com'



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

visakh16
Very Important crosS Applying yaK Herder

India
47099 Posts

Posted - 08/01/2012 :  16:37:53  Show Profile  Reply with Quote
howzz current format of email? does it have first and last names in it?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.06 seconds. Powered By: Snitz Forums 2000