Mega Code Archive

 
Categories / Delphi / ADO Database
 

Bcd number truncate to only 4 decimal places

Question: When I use the BDE setting ENABLE BCD, all my data is truncated to 4 decimal places. Is this as designed? Answer: Delphi uses the Delphi Currency type for holding the BCD values internally. This is a actually a signed 64 bit integer (comp) with the last 4 digits used for the decimal places. If a BCD value from BDE that contains more than 4 decimals, an exception is raised. The only way to work with more decimal places than 4 is to call GetData on the field and work directly with the FMTBCD structure.