Click here to Skip to main content
15,891,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a data base with 4 tables
Table1 has 1 column car
Table2 has 2 columns car,type
Table3 has 3 columns car,type,owner
Table4 has 4 columns car,type,owner,reg
I want to change the value of car column for table 2 3 and 4 when it changes in table 1 and change the value of type column in table 3 and 4 when it changes in table 2
and change the value of owner column in table 4 when it changes in table 3 same when i create a new entry for car I want it to be created in all the below tables
Posted
Comments
Andrei Straut 18-Sep-12 9:33am    
This sounds more like a design nightmare.

However, I have once heard of PostgreSQL offering a table inheritance system, you might wanna take a look into it (if you're not limited to a certain RDBMS)

1 solution

Hi,

You can create after trigger in your code.

Check MSDN Article on SQL Trigger[^]

Trigger will update your corresponding table if the table is updated.

So, you need to create After update trigger on Table1, Table2, Table3.

It will works for you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900