dbTalk Databases Forums  

VARBINARY value to FLOAT, domain error

comp.databases.sybase comp.databases.sybase


Discuss VARBINARY value to FLOAT, domain error in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ade talabi
 
Posts: n/a

Default VARBINARY value to FLOAT, domain error - 12-10-2003 , 06:42 AM






I have just migrated from Sybase 11, to 12.

A piece of code

(select date from OPQ where STR(v) like '%NaN')

that use to work before, converting a varbinary to string now fails
with the following error...

1 1 Number (245) Severity (16) State (1) Server (Jounl001) Domain
error during implicit convesion of VARBINARY value '.yyyy' to a FLOAT
field.


Any solutions?

Reply With Quote
  #2  
Old   
Bret Halford
 
Posts: n/a

Default Re: VARBINARY value to FLOAT, domain error - 12-10-2003 , 02:05 PM






adetalabi (AT) hotmail (DOT) com (ade talabi) wrote in message news:<bacaae2.0312100442.4f7d72aa (AT) posting (DOT) google.com>...
Quote:
I have just migrated from Sybase 11, to 12.

A piece of code

(select date from OPQ where STR(v) like '%NaN')

that use to work before, converting a varbinary to string now fails
with the following error...

1 1 Number (245) Severity (16) State (1) Server (Jounl001) Domain
error during implicit convesion of VARBINARY value '.yyyy' to a FLOAT
field.


Any solutions?

The values "Inf" and "NaN", while valid under the floating point
standard, are not allowed in SQL, although older versions of
ASE allowed them to be inserted in error. In particular CR 271561
implemented in 12.5.0.3 and above a low-level check to prevent such
values from being inserted in ASE. However, there may still be legacy
data in a database with such values in it. Traceflag 4067 turns off
the check, but my advice would be to go through your data and scrub
it of such values.

Here is an approach to find both "Inf" and "Nan" values in floating
point columns on big-endian systems:

Code to find invalid REAL values:

select realcolumn from mytable where
convert(int,convert(binary(8),realcolumn) & convert(int,0x7f80) =
convert(int,0x7f80)

Code to find invalid DOUBLE PRECISION values:

select floatcolumn from mytable where
convert(int,convert(binary(8),floatcolumn) & convert(int,0x7ff0) =
convert(int,0x7ff0)


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.