How can we create history table with minimal columns

  • Hi , How can we create history if any insert and update in table.

    I have table City with (Cityid,CityName, Citypincode) and history(ID,CityName,VersionNo) table . How can i capture details in History table if any new record insert and any update's on CityName .

  • Temporal tables allow a table history but that’s the whole table. Shadow tables can be created with insert/update triggers and you can configure for the coins you want.

     

     

  • Based on sql version you are using. If Sql 2016 temporal table is a good option.

    otherwise some other ways -

    • Trigger
    • Merge statement

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply