Home All Groups Group Topic Archive Search About

Database/ Table Property

Author
21 Jul 2006 2:57 PM
aacftc
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

Author
21 Jul 2006 3:20 PM
Paul Nielsen (MVP)
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
Author
21 Jul 2006 3:29 PM
aacftc
it's an application code
--
aacftc


Show quote
"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
>
>
>
Author
21 Jul 2006 3:50 PM
Arnie Rowland
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

--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


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
Author
23 Jul 2006 5:17 AM
Uri Dimant
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

AddThis Social Bookmark Button