建表语句
---
CREATE
TABLE Terminal_Monitor_Data
(
PK_CODE VARCHAR(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
DeviceId VARCHAR(50) COLLATE Chinese_PRC_CI_AS,
SurveyDate DATETIME,
BloodPressureUp VARCHAR(50) COLLATE Chinese_PRC_CI_AS,
BloodPressureDown VARCHAR(50) COLLATE Chinese_PRC_CI_AS,
PLUS VARCHAR(50) COLLATE Chinese_PRC_CI_AS,
HeartRate VARCHAR(50) COLLATE Chinese_PRC_CI_AS,
CONSTRAINT PK_TERMINAL_MONITOR_DATA PRIMARY KEY (PK_CODE)
)
---
我用了这个语句
select * from Terminal_Monitor_Data where cast(PLUS as float) > 15
报错 将数据类型 varchar 转换为 float 时出错
求解.....
------解决方案--------------------
select * from Terminal_Monitor_Data where rtrim(PLUS)*1.0 > 15
确保plus全是数字
------解决方案--------------------
select * from Terminal_Monitor_Data
where case when isnumeric
(plus)=1 then cast(PLUS as float) else 0 end> 15