Author |
Topic  |
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 11:16:50
|
ReportID expenseReportDate expenseStartDate expenseEndDate monthlyExpenses monthlyBudgeted monthlyBudgetVariance ytdExpenses ytdBudgeted ytdBudgetedVariance expenseExplain CapitalReportDate CapitalStartDate CapitalEndDate monthlyCapitalExpenses monthlyCapitalBudgeted monthlyCapitalVariance ytdCapitalExpenses ytdCapitalBudgeted ytdCapitalBudgetedVariance CapitalExplain employeeName employeeJobTitle employeeDepartment employeeEmail employeeManager ManagerEmail 18 10/3/2006 10/10/2006 10/19/2006 4000 6000 2000 4000 0 10/3/2006 10/11/2006 10/19/2006 6000 8000 2000 0 Patrick Michael Software Engineer Security JohnDoe@uhaul.com Mike Ferrel HarryDawn@cox.com 19 10/10/2006 10/3/2006 10/27/2006 5600 7000 1400 5600 0 10/2/2006 10/4/2006 10/6/2006 34000 45000 11000 0 sdfhh John Doe Cook Helper One I.T. JohnDoe@uhaul.com Mike Ferrel HarryDawn@cox.com
create trigger tu_trigger_name on yourtable for update as begin update t set ytdExpenses = t.ytdExpenses + i.monthlyExpenses - d.monthlyExpenses from inserted i inner join deleted d on i.pk = d.pk inner join yourtable t on i.pk = t.pk end
|
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 11:18:31
|
It won't all fit correct on the page. Sorry |
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 11:22:48
|
monthlyExpenses 4000 5600
|
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 11:30:11
|
ReportID expenseReportDate expenseStartDate ExpenseEndDate monthlyExpenses monthlyBudgeted monthlyBudgetVariance ytdExpenses ytdBudgeted ytdBudgetedVariance expenseExplain |
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 11:34:35
|
Are you there? |
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 12:02:20
|
khtan
I tried to post my table structure but it won't all fit on the screen. Can you help me?
|
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
7020 Posts |
Posted - 10/16/2006 : 12:31:16
|
quote: Originally posted by Michael71
Are you there?
Bueller? Bueller?...
CODO ERGO SUM |
 |
|
SwePeso
Patron Saint of Lost Yaks
Sweden
30421 Posts |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
Posted - 10/16/2006 : 21:03:24
|
quote: Originally posted by Michael71
Are you there?
Hey. I am not a bot 
KH
|
 |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/16/2006 : 22:00:51
|
Khtan,
The code you gave me didn't update everytime I submitted to the database.. Any ideas |
 |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
|
Michael71
Posting Yak Master
USA
126 Posts |
Posted - 10/17/2006 : 15:53:43
|
khtan,
Could you help me out with a trigger..I just can't get this database to update when I know it should. I just think I want the ytdExpenses Column to read the same..can you help me out with this..Please....just a trigger that will do this in a simple way..everytime I submit to the database. Here is the trigger I have create trigger tu_ytdExpenses on yourtable for update as begin update t set ytdExpenses = t.ytdExpenses + i.monthlyExpenses - d.monthlyExpenses from inserted i inner join deleted d on i.pk = d.pk inner join yourtable t on i.pk = t.pk end
monthlyExpenses ytdExpenses $1,000 $13,000 $2,000 $13,000 $3,000 $13,000 $2,000 $13,000 $5,000 $13,000 |
 |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
|
Topic  |
|