We have a product (exchequer finance) that stores its data in a pervasive (bTrieve) database. As part of our business intelligence development cylce I have a requirement to import the data from the pervasive database to MSSQL. I have achieved this using SSIS without issue however am now facing a totally unforseen issue!
The pervasive database engine is based on DDF files that have a number of limitations, one such limitation is in its handling of numeric data. In order to work around this the application developer split all financial values between two fields, Field_1 and Field_2 and then uses a function stored in a DLL to recombine the data to make a single currency field.
the application developer has kindly provided a reference to this function in the help file as thus -
Due to the data structures used by Exchequer most of the floating point numbers are not directly accessible using DDFs. To overcome this problem we have split the numbers into 2 fields, a 2-Byte Integer and a 4-Byte Integer, these are indicated by a '_1' and a '_2' after a shared field name. We have provided a function EntConvertInts in EntFuncs.Dll to convert these to a standard Double type which can be used in most programs.
Additionally they have provided a comparable delphi function definition that should work.
my challenge is I am not a delphi developer and I need something in VB or even better transact SQL that will do the same thing as the below code extract.
H E L P !
Function EntConvertInts ( Const Int2 : SmallInt; Const Int4 : LongInt) : Double; StdCall;
TheRealArray : Array [1..6] Of Char;
TheReal : Real;
Move (Int2, TheRealArray, 2);
Move (Int4, TheRealArray, 4);
Move (TheRealArray, TheReal, 6);
Result := TheReal;