tsql - Currency Conversion Logic for multiple rows -
i have question regarding currency conversion logic. currently, return result set has got many currency fields. now, requirement says users should have option select output currency format
eg:
account name | actual amount | estimated amount | target amount xyz | $ 2000 | $ 456.78 | $ 890.45 abc | sd 2000 | sd 456.78 | sd 890.45
if user selects yen output format, result set should
account name | actual amount | estimated amount | target amount xyz | ¥ 2233 | ¥ 42356.78 | ¥ 82390.45 abc | ¥ 21213000 | ¥ 41156.78 | ¥ 82390.45
the exchange rate available, , know have function call in select statement convert currency columns. but, making function call each record increases execution time.
is there other logic used improve execution time.
when use function conversions, have know every single record function executed. when @ overhead of executing function, you'll have executions have records.
you can better make conversion table, put conversion rate in it, , join against one. make sure have column holds currency in both conversion rate table , original table, , go. in select statement output formula, rate*actual amount.
Comments
Post a Comment