Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

SQL Update Statement

I am trying to update a column by removing 'mail' from the email addresses.  I use this:

Update employees2
Set email = (SELECT REPLACE(email,'mail.xxxx.edu','xxxx.edu')
from employees2);

However, I get this error message:
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

How can I fix
0
Jack Seaman
Asked:
Jack Seaman
1 Solution
 
Steve WalesSenior Database AdministratorCommented:
Just this should work:

Update employees2
Set email = REPLACE(email,'mail.xxxx.edu','xxxx.edu')

You don't need to select the data again.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now