Skip to Content.
Sympa Menu

freetds - RE: conversion status

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: conversion status
  • Date: Fri, 30 Aug 2002 13:06:13 -0400


> From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafoneomnitel.it]
> Sent: August 30, 2002 11:50 AM
>
> Wow so in your machine sizeof(TDS_INT8) == 4 ??

Um, er, yes? Actually, in config.cache:

ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}

but in fact there's no long long or atoll() on that machine.

> > > > smallmoney odd 201203.04 -> real yields 201203.046875
>
> 201203,04 =
> 1-100010001111100110000101000111101
> 12345678901234567890123 = 23 digit of precision
>
> so can be from
> 110001000111110011000010 = 201203,03125
> to
> 110001000111110011000011 = 201203,046875
> (best this last)
>
> log (2^24) = 7.224...
> So only 7 digits should be right (sometime 8).

That's very clear. Thank you for that explanation. I learned something
today.

And I always thought binary data was [sic] made of hexadecimal numbers. ;)

For anyone who's not convinced, there's another way to look at it:

1> select convert( real, convert( smallmoney, 201203.04 ) )
2> go

--------------------
201203.046875

How about that, huh? They use the same numbers we do. ;)

> > I don't know. I don't use blobs of any kind, and I've never
> > thought about converting them to anything.
>
> ?? blobs ??

Binary Large OBjects. Refers to any datatype that the database can hold
that SQL can't evaluate.

I went to AT&T's operational headquarters some years ago, heard a talk about
ensuring network availability. One thing they do is fly over their main
trunk routes, looking for LYOs.

LYO? Large Yellow Object. Bulldozers and such, things that dig in the
ground and and find fiber optic cable by accident.

> I was thinking conversion from int -> binary. Should be just
> a memcpy or should we swap bytes (like bigendian->littleendian) ?

Don't know. Would have to experiment and/or listen to Brian.

MS documentation says binary & image store "a string of bits". I know what
that means in theory, but not in (their) practice.

1> create table #i(i varbinary(20))
2> insert #i values ( 0x100 )
3> insert #i values ( 0x11223344 )
4> select * from #i
5> go
i
------------------------------------------
0x01
0x11223344

1> select cast(i as int) from #i
2> go

-----------
1
287454020

$printf "%x\n" 287454020
11223344

I don't know about you, maestro, but where I come from I'll trade you 1 for
0x100 any day of the week. I would have expected the first row to be 256.

Regards,

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page