Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update Columns Table When I Make A Change In Others

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-05 : 07:24:13
Oliver writes "Hi,

I'm from Dominican Republic, so I want to excuse for my English.

I have three (3) Tables That use a common field each, called "Cedula", When i change or modify a field of the first (Primary Table) I want that the two others Changes automatically.

I Was trying wiht Trigger but it does't work.

I hope you can help me, And understood my Question.

Thanks,

Oliver Santomas"

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-08-05 : 09:47:09
Oliver, aren't you making this situation painful for yourself by having the same data in three places at the same time? Why bother with having to update the data in two other places, when it is changed in only place? Simple solution, delete this column from the other two tables, and keep it only in your primary table.

If you've got some business requirements that dictate such a design, post the details here, and we can help.

Owais
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2003-08-06 : 09:10:43
Owais...i think you're overlooking the possibility that the data is involved in a parent-child relationship...and that the value being changed is the key....as per a clue in 'primary table'


also...you're looking at it from the 'ideal situation' rather than as a 'this is the way it is, and i've to deal with it' situation..


What Oliver seems to be need is a 'cascade update', which I think only is supported automatically in sql2000. the 6.5/7.0 alternatives are triggers....and should work if coded right....sample data structures and code would help move this problem along towards a solution.
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-08-06 : 09:45:04
Yo Andrew!
Yeah, I guess came down too hard on the poor guy (had a rough time at work yesterday) Certainly there is a possibility that this column might be part of a primary key in a parent-child relationship. Hey oliver, how about some DDL?!

Cheers

Owais
Go to Top of Page
   

- Advertisement -