表中字段A的属性为nvarchar型
里面的数据都是91,203,182这种格式的内容;
这时候要按一个数字作为条件来查询;
如:select * From table where A>91203000
这段查询语句要怎么过滤掉"91,203,182"中的,号呢?
里面的数据都是91,203,182这种格式的内容;
这时候要按一个数字作为条件来查询;
如:select * From table where A>91203000
这段查询语句要怎么过滤掉"91,203,182"中的,号呢?
---这个意思吗?
insert into @t select '91,203,182'select * From @t where replace([str],',','')>'91203000'
--这样?
select * from table where cast(replace(A,",",'') as int)>91203000
服务器: 消息 8114,级别 16,状态 5,行 1
将数据类型 nvarchar 转换为 bigint 时出错。
用CONVERT試試
select * From table where cast(replace(A,',','') As float) > 91203000