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
 Update Multiple Rows

Author  Topic 

ZoneFX
Starting Member

17 Posts

Posted - 2007-04-01 : 09:13:43
I have to update the domain name on our email database. Is there a simple update I can use to change firstname.secondname@olddomain.com to firstname.secondname@newdomain.com. I've got about 2800 records to update and I don't fancy either loosing them all by doing a dogy update query or doing it one at a time.

Any help would be greatly appreciated................

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-01 : 09:32:14
UPDATE Table1
SET Col1 = LEFT(Co1, CHARINDEX('@', Col1)) + 'newdomain.com'


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

ZoneFX
Starting Member

17 Posts

Posted - 2007-04-01 : 09:50:14
Absolutely perfect thanks!!!

I forgot to ask about there being other domain nmes than olddomainname.com, but I worked that out with a where clause!!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-01 : 12:08:35
Great!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -