February 2, 2011 at 4:46 am
nandakrishnacherukuri (2/2/2011)
I got the answer with both the options . Is there any option other than Trigger,on update cascade
Trigger without on update cascade - write extra code in the trigger to make changes to the child table (maybe you want to make changes even if something other than the key changes, maybe you want to change something as well as the key).
Also, if you have a reasonable design updates are done by stored procedures, not by raw code handed in by the app, so you can make the procs that do the updates do whatever extra you want.
Tom
February 2, 2011 at 6:49 am
shanureddy (2/2/2011)
Okay.. Now tel me if any other alternative other than dis two approaches..Not on update cascade & trigger.
Is there any other method???????????????
Yes, there are several other methods. These are in order of best to worst.
First, normalize your data so you don't have to update it in multiple tables.
Second, design your primary key so that it doesn't have to be updated (it should be static through the life of the data).
Third, write update statements that update the data in every table that contains the data. This is the same as writing a trigger, except you write it in a stored procedure or in the Data Access Layer of your application, instead of in a trigger.
Fourth, update each table separately and on its own.
Fifth, Build your whole database as one big table with all the data in it, and update that table only.
Sixth, instead of a database, just store the data as object properties, and use inheritence and polymorphism to cascade data changes down the chain.
I hate to go all Joe Celko on you, but it sounds like you're dealing with something that isn't really a relational database at all. You need to study how to design databases correctly, and then use that data to build a database that correctly handles this kind of situation without getting into offbeat and oddball solutions.
How much do you know about relational database design, operation, use, and development?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 2, 2011 at 7:26 am
GSquared (2/2/2011)
shanureddy (2/2/2011)
Okay.. Now tel me if any other alternative other than dis two approaches..Not on update cascade & trigger.
Is there any other method???????????????
Yes, there are several other methods. These are in order of best to worst.
...
Eight. Use MS Access
Nine. Use Excel to store the data
😀
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply