MS SQL currency type shown as float in schema builder

hi, using SDAC with DA, the MS SQL currency type is still being treated as float…
is there a way to change that?

Hi,

have you tried to specify datCurrency type for this field?

you mean change this manually?
yes off course, otherwise it’s treated as a float instead of a currency in delphi…

point is that the schema builder should make it datcurrency instead of datfloat no?

what sql type do you have for this table? auto sql or custom sql? in case of custom sql, datatypes were detected by SDAC

hmmm don’t see why it should be different in either case but we use custom sql yes…

in case of autosql we read data types directly from table metadata
in case of custom sql, we use data types that returns correspondent DAC (in your case SDAC) because you can have complex SQL like

select 
    1.0+2.3 as fld1, 
    (select a from tableB ...) as fld2
...

i understand, so i have to take it up with devart then?

according to https://www.devart.com/sdac/docs/data_type_mapping.htm , they already map decimal(10,4) to ftBCD

so?
does this mean you interpret ftbcd as datfloat then?
can we change the mapping so the schema builder sees it as currency?
this is very annoying, cause every time you add a field to the query, all currency fields are float again, which results in unwanted behaviour in our app like to many digits when calculating when currency is expected

try to create table with autosql. how to fields will be declared - as float or currency?

autosql does create the fields as currency…

so problem with SDAC. probably this mapping isn’t set by default …

correct me if i’m wrong, but i guess autosql also uses the sdac connection or not?

bottom line, i need a solution for this cause it results in errors for our clients and i do not always keep in mind to check float vs currency…

yes, SDAC connection is used.

for autosql we call MSSQL_DoGetTableFields method (uDAADOInterfaces.pas) that read table metadata

try to add to aux parameters of connection: EnableBCD=True. it may help

https://www.devart.com/sdac/docs/devart.sdac.tmsdatasetoptions.enablebcd.htm

call me stupid but how do i do that? :slight_smile:

something like

hmmm tried that but didn’t work, will retry