我有包含空格的列與數據:
例如:| |魚| 我如何更新列,以便我的結果是:|魚| ?
在Oracle我可以修剪列:
刪除ASE列中的空格
update Example set column1 = trim(column1)
我google一下,我注意到,ASE犯規supoort裝飾。
我有包含空格的列與數據:
例如:| |魚| 我如何更新列,以便我的結果是:|魚| ?
在Oracle我可以修剪列:
刪除ASE列中的空格
update Example set column1 = trim(column1)
我google一下,我注意到,ASE犯規supoort裝飾。
update Example set column1 = rtrim(ltrim(column1))
update Example set column1 = str_replace(column1,' ','')
我發現str_replace函數(列1, '', '')實際上並沒有替換空間。
切換'爲空的作品:
create table Example (column1 varchar(15))
insert into Example (column1) values ('| fish |')
select * from Example
-- produces "| fish |"
update Example set column1 = str_replace(column1, ' ', null)
select * from Example
-- produces "|fish|"
drop table Example
與str_replace函數(列1,」」, '')鴕鳥政策爲我工作。但是,str_replace(column1,'',null)對我來說工作正常。 – jonatanes
@jonatanes可能取決於ASE的版本。可能你有更新的版本比我4(sic!)年前!答案被接受,所以對於OP的ASE版本來說是好的。你認爲下調對這種情況有好處嗎? – Parado