开发者

SQL replace syntax

开发者 https://www.devze.com 2023-03-01 02:45 出处:网络
I have a sele开发者_JAVA百科ct query that gets a field and displays it with a custom name, ex acctID as ACCOUNT ID. If the data for this field is a varchar but is all numbers with decimals ex 000.887.

I have a sele开发者_JAVA百科ct query that gets a field and displays it with a custom name, ex acctID as ACCOUNT ID. If the data for this field is a varchar but is all numbers with decimals ex 000.887.4456.000000, how do I use replace in that select query to remove the decimals from a field like this?


SELECT REPLACE(acctID, '.', '') AS ACCOUNT_ID FROM TABLE

REPLACE function reference here


REPLACE(acctID, '.','') AS AccountID


SELECT 
    ex.acctID,
    REPLACE(ex.acctID, '.', '')
FROM
    Mytable
0

精彩评论

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