Discussion:
Better for perfomance
(too old to reply)
Meels Lilbok
2008-01-30 06:36:24 UTC
Permalink
Hello all


Im using SQL Server 2005, ADO 2.9, OLEDB.

My question is;

Lets say we have 2 tables ITEMS and LOANS

When item is "checked out", i insert line into LOANS table and in ITEMS
table field state_id is changed from 1 to 3 using UPDATE ITEMS SET
STATE_ID=3 WHERE ID=
Now, what is better for perfomance - INSERT and UPDATE querys are both in
source code (client side)
or INSERT is in source code and UPDATE using triggers on LOANS table using
AFTER INSERT?



Best Regards;
Meelis
Uri Dimant
2008-01-30 06:50:07 UTC
Permalink
Meels
I'd go with single stored procedure . Clients just call it.
Post by Meels Lilbok
Hello all
Im using SQL Server 2005, ADO 2.9, OLEDB.
My question is;
Lets say we have 2 tables ITEMS and LOANS
When item is "checked out", i insert line into LOANS table and in ITEMS
table field state_id is changed from 1 to 3 using UPDATE ITEMS SET
STATE_ID=3 WHERE ID=
Now, what is better for perfomance - INSERT and UPDATE querys are both in
source code (client side)
or INSERT is in source code and UPDATE using triggers on LOANS table using
AFTER INSERT?
Best Regards;
Meelis
Paul Nielsen (SQL)
2008-01-30 07:18:17 UTC
Permalink
The best solution is to create a great stored procedure that inserts/updates
into both tables and have the client app call the proc.

-Paul
Post by Meels Lilbok
Hello all
Im using SQL Server 2005, ADO 2.9, OLEDB.
My question is;
Lets say we have 2 tables ITEMS and LOANS
When item is "checked out", i insert line into LOANS table and in ITEMS
table field state_id is changed from 1 to 3 using UPDATE ITEMS SET
STATE_ID=3 WHERE ID=
Now, what is better for perfomance - INSERT and UPDATE querys are both in
source code (client side)
or INSERT is in source code and UPDATE using triggers on LOANS table using
AFTER INSERT?
Best Regards;
Meelis
Loading...