Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update part of table

Status
Not open for further replies.

Bengyke

IS-IT--Management
Apr 8, 2004
7
I have an SQL database "aaa" with table "bbb". In this table I have a field named "emailaddr". In this field, at the moment there is a value test@hostname.com

Who can I change only the hostname.com value in the field ?

So I am searching for an UPDATE command where I can define this part of the field.

 
depending on which database system you're using...

update bbb
set emailaddr
= replace(emailaddr,'hostname.com','example.com')

r937.com | rudy.ca
 
forget to add the WHERE clause to prevent updating all rows needlessly...

update bbb
set emailaddr
= replace(emailaddr,'hostname.com','example.com')
where emailaddr like '%hostname.com'

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top