开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜