简体   繁体   English

将数值转换为数值类型的算术溢出错误

[英]Arithmetic overflow error converting numeric to data type numeric

I have executed this query on 2 different databases: 我已经在2个不同的数据库上执行了此查询:

Update table1 set PresencePayFactor = cast(30 as decimal (4,2))/ 30 更新表1设置PresencePayFactor = cast(30为十进制(4,2))/ 30

it is working on one but not on the other. 它在一个方面起作用,但在另一方面却不起作用。 the 2 databases are sql server 2008 R2 2个数据库是sql server 2008 R2

it is giving the following error "Arithmetic overflow error converting numeric to data type numeric." 它给出以下错误“将数字转换为数据类型数字的算术溢出错误”。

What may be the problem? 可能是什么问题?

Is NUMERIC_ROUNDABORT set differently between the two? 两者之间的NUMERIC_ROUNDABORT是否设置不同?

SET NUMERIC_ROUNDABORT OFF
GO
Declare @TestTable Table ( PresencePayFactor decimal(4,2) null )
Insert @TestTable( PresencePayFactor )
Select Cast( 30 As decimal(4,2) ) / 30
GO
-- No error

SET NUMERIC_ROUNDABORT ON
GO
Declare @TestTable Table ( PresencePayFactor decimal(4,2) null )
Insert @TestTable( PresencePayFactor )
Select Cast( 30 As decimal(4,2) ) / 30
-- Arithmetic overflow error converting numeric to data type numeric.

SET NUMERIC_ROUNDABORT (Transact-SQL) SET NUMERIC_ROUNDABORT(Transact-SQL)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:将数字转换为数据类型数字的算术溢出错误 - Error: Arithmetic overflow error converting numeric to data type numeric 在执行查询时将数值转换为数值类型的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric on query execution 在插入时将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric on insert 将数值转换为数值类型的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric 将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric SQL 8115将数值转换为数据类型numeric的算术溢出错误 - SQL 8115 Arithmetic overflow error converting numeric to data type numeric 将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric 算术溢出错误将数字转换为数据类型数字 - Arithmetic overflow error converting numeric to data type numeric 算术溢出错误将varchar转换为数据类型numeric -error - Arithmetic overflow error converting varchar to data type numeric -error 错误:将数字转换为数据类型varchar的算术溢出错误 - Error : Arithmetic overflow error converting numeric to data type varchar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM