dbTalk Databases Forums  

trig errors

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss trig errors in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Daft Pict
 
Posts: n/a

Default trig errors - 01-30-2008 , 10:34 AM






Greetings,
I am getting a data conversion error I cannot explain!

This statement

UPDATE dbImageList
set cx = COS(RADIANS(CRVAL2))*COS(RADIANS(CRVAL1)),
cy = COS(RADIANS(CRVAL2))SIN(RADIANS(CRVAL1)),
cz = SIN(RADIANS(CRVAL2))

results in this error message
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type float.
The statement has been terminated.


However, all fields crval1,crval2,cx,cy,cz are datatype float in the
table.

Any suggestions on how to perform this computation?
Thanks
-Brian

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: trig errors - 01-30-2008 , 04:48 PM






Daft Pict (brianjmclean (AT) gmail (DOT) com) writes:
Quote:
Greetings,
I am getting a data conversion error I cannot explain!

This statement

UPDATE dbImageList
set cx = COS(RADIANS(CRVAL2))*COS(RADIANS(CRVAL1)),
cy = COS(RADIANS(CRVAL2))SIN(RADIANS(CRVAL1)),
cz = SIN(RADIANS(CRVAL2))

results in this error message
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type float.
The statement has been terminated.


However, all fields crval1,crval2,cx,cy,cz are datatype float in the
table.

Any suggestions on how to perform this computation?
I would certainly help if you could post a script that demonstrates
the problem. That is, the script would include the CREATE TABLE statement
for the table, and INSERT statements for data that causes this problem.

Else we are left a bit in the dark.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #3  
Old   
Ed Murphy
 
Posts: n/a

Default Re: trig errors - 01-30-2008 , 10:18 PM



Daft Pict wrote:

Quote:
Greetings,
I am getting a data conversion error I cannot explain!

This statement

UPDATE dbImageList
set cx = COS(RADIANS(CRVAL2))*COS(RADIANS(CRVAL1)),
cy = COS(RADIANS(CRVAL2))SIN(RADIANS(CRVAL1)),
There's a missing * here; is that typo in your actual code, or did it
just sneak in when you wrote your post?

Quote:
cz = SIN(RADIANS(CRVAL2))

results in this error message
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type float.
The statement has been terminated.


However, all fields crval1,crval2,cx,cy,cz are datatype float in the
table.

Any suggestions on how to perform this computation?
First try it with a WHERE clause that limits it to a single row of the
table. If that succeeds, then do a few binary chops to determine which
rows do or don't have problems.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.