Reputation: 1130
In my database, I have a specific request.
For some tables, let's call one Customer
, I have a copy of it, let's call it Customer2
that needs to save some changes made on the records of the first one.
So, whenever I add a column to Customer
, it needs to be added to the second one.
Since I'm doing it in a lot of tables, I cant simply duplicate the add column script.
I was thinking on using a DDL script for it, but cant seem to find a working solution.
Basically, what I need is to have a trigger, that whenever a table schema is changed, it would replicate the said change to the "copy" table.
Thanks in advance.
Upvotes: 0
Views: 1265
Reputation: 1269493
What you are looking for is a DDL ("data definition language") trigger. You can specify such a trigger on alter table
-- to capture when a new column is added.
The place to start is the documentation.
Upvotes: 1