|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Database/ Table PropertyI have an applictaion where when I update/ insert any record in child tables,
it calls update statement for parent table (poorly designed) so I want to know if there is any database/ table property which I can set to check run commit only in case update statement is really making changes to the table. or if not what how shall I resove the issues without making changes to the code. -- aacftc Q. When you say "it calls update statementment" what exactly is the it? a
stored procedure, a trigger, or the application code? Knowing that will help us answer your question. -Paul Show quote "aacftc" <aac***@discussions.microsoft.com> wrote in message news:DEF652F6-0922-484A-B5BB-0E3750CA135C@microsoft.com... >I have an applictaion where when I update/ insert any record in child >tables, > it calls update statement for parent table (poorly designed) so I want to > know if there is any database/ table property which I can set to check run > commit only in case update statement is really making changes to the > table. > or if not what how shall I resove the issues without making changes to the > code. > > -- > aacftc it's an application code
-- Show quoteaacftc "Paul Nielsen (MVP)" wrote: > Q. When you say "it calls update statementment" what exactly is the it? a > stored procedure, a trigger, or the application code? Knowing that will help > us answer your question. > > -Paul > > > > > "aacftc" <aac***@discussions.microsoft.com> wrote in message > news:DEF652F6-0922-484A-B5BB-0E3750CA135C@microsoft.com... > >I have an applictaion where when I update/ insert any record in child > >tables, > > it calls update statement for parent table (poorly designed) so I want to > > know if there is any database/ table property which I can set to check run > > commit only in case update statement is really making changes to the > > table. > > or if not what how shall I resove the issues without making changes to the > > code. > > > > -- > > aacftc > > > You could use an TRIGGER for INSERT, UPDATE.
Put the update code in the trigger, when there is an INSERT or UPDATE to the child table, the trigger can check the inserted and deleted values, and if they are different, will make the associated changes in the parent table, and if the parent table update fails, then the child table update fails also. In the trigger, you would check the inserted and deleted values, and if they are different, make the changed. Here is a short 'tutorial' on creating Triggers. http://www.sqlteam.com/item.asp?ItemID=3850 -- Show quoteArnie Rowland Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous "aacftc" <aac***@discussions.microsoft.com> wrote in message news:DEF652F6-0922-484A-B5BB-0E3750CA135C@microsoft.com... >I have an applictaion where when I update/ insert any record in child >tables, > it calls update statement for parent table (poorly designed) so I want to > know if there is any database/ table property which I can set to check run > commit only in case update statement is really making changes to the > table. > or if not what how shall I resove the issues without making changes to the > code. > > -- > aacftc Hi
As others have already said you can use TRIGGERS to get what you want. Another option may be considered is to write those UPDATE/DELETE/INSERT statements along with Parent's update/insert/delete in the one batch Show quote "aacftc" <aac***@discussions.microsoft.com> wrote in message news:DEF652F6-0922-484A-B5BB-0E3750CA135C@microsoft.com... >I have an applictaion where when I update/ insert any record in child >tables, > it calls update statement for parent table (poorly designed) so I want to > know if there is any database/ table property which I can set to check run > commit only in case update statement is really making changes to the > table. > or if not what how shall I resove the issues without making changes to the > code. > > -- > aacftc |
|||||||||||||||||||||||