Reputation: 13
I am working on this:
I would like to know how to create a new column that holds the amount equal to LocalCurrency
multiplied by ExchangeRate
for each rows of item.
Upvotes: 0
Views: 119
Reputation: 1
You can calculate when required in a query or can create a view to do so and use it wherever required.
CREATE VIEW Purchase_details AS
SELECT *, localcurrencyamount*exchangerate
FROM your_table_name
Select * from Purchase_details
Upvotes: 0
Reputation: 1270823
Use a computed column:
alter table t add newcolumn as (localcurrency * exchangerate);
This adds the column to the table so it is calculated automatically when you retrieve it. The value is automatically set so no update is needed.
Upvotes: 1