我正试图将括号内的内容转换为浮点类型,但仍然会出现相同的错误。
为了在转换之前将整个表达式封装在float中,我已经尝试了更改括号,但它仍然会给我同样的错误。请告诉我怎样才能避免这个错误。

SELECT
    inter.IDIntervento, 'Intervento principale' as _IDInterventoTipo, 1 as _IDInterventoTipoN,
    inter.IDIntervento as _IDInterventoRif, inter.IDInterventoV,
    IDCartella, IDCdc, IDCdc|| IDCartella as IDCdcIDCartella,
    ECO.TipoCardio,
    ECO.DataEsame,
    ECO.Operatore,
    ECO.TipoEco,
    convert(float,replace(ECO.DiametroTelediastolicoVentricoloSinistro,',','.')) as VentricoloSinistro_DiametroTelediastolico,
    convert(float,replace(ECO.VolumeTelediastolicoVentricoloSinistro,',','.')) as VentricoloSinistro_VolumeTelediastolico,
    convert(float,replace(ECO.DiametroTelediastolico2VentricoloSinistro,',','.')) as VentricoloSinistro_DiametroTelediastolico2,
    convert(float,replace(ECO.VolumeTelediastolico2VentricoloSinistro,',','.')) as VentricoloSinistro_VolumeTelediastolico2,
    (SELECT cast(idinterventovalore as varchar(5))|| '='|| valore
    FROM cch.pats_cch_interventi_valori val

最佳答案

函数convert将字符串从一种编码转换为另一种编码。
要将字符串转换为浮点数,请使用类型转换:

CAST (replace(ECO.DiametroTelediastolicoVentricoloSinistro,',','.')
      AS double precision) AS VentricoloSinistro_DiametroTelediastolico

10-06 03:08