34,838
社区成员




create table pos_vip_info
(
card_type char(10),
other2 varchar(10)
)
insert pos_vip_info
select '01','123.5' union all
select '02','15.623' union all
select '03','0.5' union all
select '04','13.5'
select * from pos_vip_info where convert(int , card_type)>1
/*
card_type other2
---------- ----------
02 15.623
03 0.5
04 13.5
(3 行受影响)*/
select * from pos_vip_info where convert(int , other2)>1
/*
-----------
card_type other2
---------- ----------
消息 245,级别 16,状态 1,第 2 行
在将 varchar 值 '123.5' 转换成数据类型 int 时失败。
*/
select * from pos_vip_info where convert(numeric , other2)>1
/*
card_type other2
---------- ----------
01 123.5
02 15.623
04 13.5
(3 行受影响)
*/
go
drop table pos_vip_info