数据类型 对数据类型而言运算符无效。运算符为 subtract,类型为 nvarchar。 我现在用的 NVARCHAR 但是我想把两个数相减 我应该改成什么数据类型最好 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 因为现在表已经导进去了 用的nvarchar 改成numeric 说改不了 cast(col as decimal(18,2))cast(col as int) subtract,不是sqlselect cast(字段 as int)-cast(字段 as int) selec 列 from 表 where isnumeric(列) = 0 找出不能转换的数据,查看是否包含全角,非数字字符等。还有就是replace(列,' ','')去空格。 select * from temp1 cast(读数 as decimal(18,2)) 这样吗?提示 AS 附近有错误 select cast(大字段 as int)-cast(小字段 as int) from temp1select cast(大字段 as decimal(18,2))-cast(小字段 as decimal(18,2)) from temp1 ODBC 错误: [Microsoft][ODBC SQL Server Driver][SQL Server]将数据类型 nvarchar 转换为 numeric 时出错。那天强制转都还行 !! 今天怎么就不行了 declare @tb table (name varchar(10))insert into @tb select nullinsert into @tb select '123'insert into @tb select 'a1'select cast(name as decimal(18,2)) from @tb 消息 8114,级别 16,状态 5,第 8 行从数据类型 varchar 转换为 numeric 时出错。 declare @tb table (name varchar(10))insert into @tb select nullinsert into @tb select '123'insert into @tb select 'a1'select * from @tb where isnumeric(name)=0NULLa1用这个查一下,看有转换错误的没 请教高手,sql结果,多行转一行,并限制列数。 恢复数据库时错误~急~ 求助,关于Navicat连接SLQ2000的问题。在线等!!! 16th northwind 按批次更新 SQL 语句 有什么办法能使两个同名数据库合并啊? SQL 2000按装不了了 这个约束怎么写? SQL SERVER的存储过程 mysql错误1215求助,不能添加外码约束 求一sql语句!! 怪事,不能取另一台服务器的数据。
cast(col as int)
找出不能转换的数据,查看是否包含全角,非数字字符等。
还有就是replace(列,' ','')去空格。
提示 AS 附近有错误
select cast(大字段 as decimal(18,2))-cast(小字段 as decimal(18,2)) from temp1
insert into @tb select null
insert into @tb select '123'
insert into @tb select 'a1'
select cast(name as decimal(18,2)) from @tb 消息 8114,级别 16,状态 5,第 8 行
从数据类型 varchar 转换为 numeric 时出错。
insert into @tb select null
insert into @tb select '123'
insert into @tb select 'a1'select * from @tb
where isnumeric(name)=0NULL
a1用这个查一下,看有转换错误的没