开发者

Any SQL strip function available

开发者 https://www.devze.com 2023-02-04 20:19 出处:网络
I am trying to run an update query which will strip - from a field.For ex开发者_JS百科ample: IDNAME

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

0

精彩评论

暂无评论...
验证码 换一张
取 消