Table name: Employee
Column Name: Emp_name
表名:Employee列名:Emp_name
Emp_name
has this contents:
Emp_name有这样的内容:
xx\rama,
xx\rajesh,
xx\vignesh
I have to update the table Employee by removing xx\
from all the rows of column Emp_name
.
我必须通过从列Emp_name的所有行中删除xx \来更新表Employee。
Please help me.
请帮帮我。
4 个解决方案
#1
12
UPDATE Employee
SET EMP_Name = REPLACE(Emp_name, 'xx\', '')
This will remove all occurences of xx\
in all records.
这将删除所有记录中xx \的所有出现。
#2
4
update Employee set
Emp_name = substring(Emp_name, 4)
where Emp_name like 'xx\\%'; -- escaped backslash as per your database flavour
#3
1
UPDATE [Employee]
SET Emp_Name=REPLACE(Emp_Name, 'xx\', '')
If you just want to just update the first, then do:
如果您只想更新第一个,那么执行:
UPDATE [Employee]
SET Emp_Name=REPLACE(Emp_Name, 'xx\', '')
WHERE Emp_Id=(SELECT MIN(Emp_Id) FROM [Employee])
#4
-1
I"m assuming this is in MS SQL, so if it is, this should work
我假设这是在MS SQL中,所以如果是,这应该工作
update Employee
set emp_name = right(emp_name, len(emp_name) - 3)
set emp_name = right(emp_name,len(emp_name) - 3)
#1
12
UPDATE Employee
SET EMP_Name = REPLACE(Emp_name, 'xx\', '')
This will remove all occurences of xx\
in all records.
这将删除所有记录中xx \的所有出现。
#2
4
update Employee set
Emp_name = substring(Emp_name, 4)
where Emp_name like 'xx\\%'; -- escaped backslash as per your database flavour
#3
1
UPDATE [Employee]
SET Emp_Name=REPLACE(Emp_Name, 'xx\', '')
If you just want to just update the first, then do:
如果您只想更新第一个,那么执行:
UPDATE [Employee]
SET Emp_Name=REPLACE(Emp_Name, 'xx\', '')
WHERE Emp_Id=(SELECT MIN(Emp_Id) FROM [Employee])
#4
-1
I"m assuming this is in MS SQL, so if it is, this should work
我假设这是在MS SQL中,所以如果是,这应该工作
update Employee
set emp_name = right(emp_name, len(emp_name) - 3)
set emp_name = right(emp_name,len(emp_name) - 3)