Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 question about a update and trigger

Author  Topic 

intern2424
Yak Posting Veteran

53 Posts

Posted - 2009-11-30 : 15:47:46
Hi, I just have a question about a trigger and a update. My update is trying to update a new column called numofcustomer to my project table. This update will add up how many different customers are part of each project and put that value in the numofCustomer column.

Update Project
Set numofCustomer =
Where

Customer table
Customerid
CustomerType
CustomerHours
ProjectID

Project table
ProjectID
ProjectName
numofCustomer


Then I was going to try and create a trigger to update that value everything I add a new customer to the table. Will it be better to use a procedure or a trigger for this.

Thanks for any help you can give.

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-30 : 15:53:58
just use the sproc already doing the update?

not a fan of derived data though

unless it a 1 time warehouse build



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-30 : 16:10:37
ok, let's work on that part first

Define:

quote:

add up how many different customers are part of each project





Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -