locked
Two SQL Table auto update RRS feed

  • Question

  • I have one table1 with 4 columns. Rows getting insert in this table automatically from application.

    I want to do some calculation with this table1 and want to save this new values in other table/same table.

    which way is the best? how can I achieve this? Please help.

    Example:

    Table1

    columns: ID, original price, sell price, customername

    based on this table, I want to create percentage, volume index and some other math columns.

    how can I achieve this?

    Saturday, August 11, 2018 4:28 AM

Answers

  • Hi SQL--DBA,

    Thanks for your question.

    >>>I want to do some calculation with this table1 and want to save this new values in other table/same table.
    which way is the best? how can I achieve this? Please help.
    If percentage, volume index and some other math columns are just measures and calculated column, then you can create the measures and calculated columns in the same table.


    Best Regards
    Willson Yuan
    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by SQL--DBA Tuesday, August 14, 2018 1:52 PM
    Monday, August 13, 2018 3:19 AM

All replies

  • Well, why did you ask your question in the Power Pivot forum?
    If your question is about database design (you talked about table), you can create extra columns in that table by using Computed Columns. If you want to store these data in another table, you can use a trigger to keep the second table sync (and you will face the trigger issues, which are not desirable). 

    see more info here: Specify Computed Columns in a Table

    If the question is related to data modeling (in the SSAS ground), you can achieve this by using the Calculated Columns

    see more info here: Lesson 5: Create Calculated Columns

     
    Saturday, August 11, 2018 5:47 AM
    Answerer
  • Hi SQL--DBA,

    Thanks for your question.

    >>>I want to do some calculation with this table1 and want to save this new values in other table/same table.
    which way is the best? how can I achieve this? Please help.
    If percentage, volume index and some other math columns are just measures and calculated column, then you can create the measures and calculated columns in the same table.


    Best Regards
    Willson Yuan
    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by SQL--DBA Tuesday, August 14, 2018 1:52 PM
    Monday, August 13, 2018 3:19 AM