您的位置:首页 > 数据库 > SQL

invalid floating point operation occurred(SQL Server发生无效浮点数操作)

2016-04-13 15:25 621 查看
原文地址:http://blog.sqlauthority.com/2012/06/28/sql-server-fix-error-3623-an-invalid-floating-point-operation-occurred/

Going back in time, I always had a problem with mathematics. It was a great subject and I loved it a lot but I only mastered it after practices a lot. I learned that mathematics problems should be addressed systematically and being verbose is not a trick, I
learned to solve any problem. Recently one of reader sent me an email with the title “Mathematics problem – please help!” and I was a bit scared. I was good at mathematics but not the best. When I opened the email
I was relieved as it was Mathematics problem with SQL Server. My friend received following error while working with SQL Server.

Msg 3623, Level 16, State 1, Line 1
An invalid floating point operation occurred.

The reasons for the error is simply that invalid usage of the mathematical function is attempted. Let me give you a few examples of the same.

SELECT SQRT(-5);

SELECT ACOS(-3);

SELECT LOG(-9);

If you run any of the above functions they will give you an error related to invalid floating point. Honestly there is no workaround except passing the function appropriate values. SQRT of a negative number will give you result in real numbers which is not
supported at this point of time as well LOG of a negative number is not possible (because logarithm is the inverse function of an exponential function and the exponential function is NEVER negative).

When I send above reply to my friend he did understand that he was passing incorrect value to the function. As mentioned earlier the only way to fix this issue is finding incorrect value and avoid passing it to the function. Every mathematics function is different
and there is not a single solution to identify erroneous value passed. If you are facing this error and not able to figure out the solution. Post a comment and I will do my best to figure out the solution.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SQL Server SQL