Any SQL strip function available
I am trying to run an update query which will strip -
from a field. For ex开发者_JS百科ample:
ID NAME
------------
1 you-me
On updating, I want to strip the "-". The result should be:
ID NAME
------------
1 youme
Is there any sql command to do this? I am using DB2.
A straight REPLACE function then?
update tbl set col = REPLACE(col, '-', '')
You can just use SQL REPLACE
function
UPDATE table
SET column = REPLACE(column, '-', '');
See this documentation
精彩评论