Extract Floating Point numbers from SQL Server image field

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
destino
Posts: 2
Joined: Thu 09 Oct 2014 22:56

Extract Floating Point numbers from SQL Server image field

Post by destino » Thu 09 Oct 2014 23:29

Greetings.

I have been given a database that has had floating point data added as an array of 500 float (standard 8 byte IEEE) values. It is a hex string 8000 characters long It can be interrogated using the Devart GetBlob function. I'm assuming its been encoded with the same product.

I need to extract this data and perform some statistical analysis upon it.

I have little experience with Delphi or the use of the Devart product and i'm trying not to have to learn a new language if I can help it.

Does anyone have any experience with SQL Server or Visual Basic that could point me in the direction to decode this data.

Here is a sample of the data and the value encoded.

0xED95FE9CEDF8903F - 0.0165745856353591

Thanks

destino
Posts: 2
Joined: Thu 09 Oct 2014 22:56

Re: Extract Floating Point numbers from SQL Server image field

Post by destino » Fri 10 Oct 2014 03:57

I have resolved my issue now.

I've had to do a couple of things.

The HEX string has to be reversed. Changed from Bigendian to Littleendian or is it the other way around.
EG. ED95FE9CEDF8903F has to be changed to 3F90F8ED9CFE95ED
and then I am able to apply the .net function BitConverter.Int64BitsToDouble(3F90F8ED9CFE95ED)
to convert it to the numeric value that I need.

All I have to do now is convert this to an MS SQL function and I think we'll be there.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Extract Floating Point numbers from SQL Server image field

Post by azyk » Thu 16 Oct 2014 10:41

It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about SDAC.

Post Reply