Shahid Karimi
Shahid Karimi

Reputation: 4357

MySQL and MS SQL query execution differs

 SELECT ACOS(31.552278760192) 

when executed in MSSQL Server it returns some value but when executed in MYSQL it returns null.

Any kind of help is appreciated.

Upvotes: 2

Views: 94

Answers (1)

mu is too short
mu is too short

Reputation: 434735

From the fine manual:

ACOS(X)
Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1.

So 31.552278760192 is out of range for MySQL's ACOS. In fact, the arccosine function doesn't produce a real number as a result outside of [-1,1] and acos(31.552278760192) is ~4i.

Upvotes: 2

Related Questions