sql server - How to store record before it updated? -


i use sql server database. have 2 tables inspections , history_inspections.

before record inspections table updated, need store history_inspections table.

i wanted use sql server update trigger fired after record updated.

any idea how can store record inspections table in history_inspections table before updated ?

when after update trigger in sql server fires, inserted pseudo table inside trigger contains new values (after update), , deleted pseudo table contains old values (before update).

so in case, read out rows deleted table , store history_inspections table.

create trigger trg_afterupdateinspections on dbo.inspections after update     insert dbo.history_inspections(list of columns)        select (list of columns)        deleted 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -