Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL
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 18-Sep-12 3:26am
mrDivan879
Comments
Andrei Straut at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

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

  Print Answers RSS
0 Maciej Los 225
1 OriginalGriff 145
2 Sergey Alexandrovich Kryukov 137
3 manoj kumar choubey 115
4 _Amy 115
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,749
3 Peter Leow 3,408
4 DamithSL 2,555


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100