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
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 UPDATE REPLACE

Author  Topic 

sycophill
Starting Member

2 Posts

Posted - 2007-04-04 : 07:15:45
Hi,

This will be first of many posts! I'm still very new to SQL!

I have a 'People' table that contains an 'Email' column (nvarchar), there are a couple of thousand values within this column that contain 'xxx.xxx.@romeike.com', which I would like to change to 'xxx.xxx.@cision.com'.

I've tried...

UPDATE People
SET Email = REPLACE ('@romeike.com','romeike','cision')

UPDATE People
SET Email = REPLACE ('%@romeike.com','romeike','cision')

(few other variations)

...but this results in every value in 'Email' being replaced with 'cision'!

Can someone please point out what I'm doing wrong? I've found some info about UPDATE .WRITE on MSDN but it doesn't give a good example.. is it even applicable?

Many thanks for your time!

Phill

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 07:19:00

UPDATE People
SET Email = REPLACE (Email,'@romeike.com','@cision.com')


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 07:25:20
.WRITE extension in SQL 2005 is applicable only for blob columns like TEXT/NTEXT/IMAGE.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

sycophill
Starting Member

2 Posts

Posted - 2007-04-04 : 07:30:05
quote:
Originally posted by madhivanan


UPDATE People
SET Email = REPLACE (Email,'@romeike.com','@cision.com')


Madhivanan

Failing to plan is Planning to fail



Madhivanan, thank you! I'm glad I was on the right path, it gives me some hope!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 08:59:01
Also Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 09:02:50
Madhivanan,

Why don't you add those links to your signature so people can have easy access to them!

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -