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
 The multi-part identifier "student.st_pay" could n

Author  Topic 

ankitkumar
Starting Member

2 Posts

Posted - 2009-10-31 : 07:46:25
Create trigger tr1 on student
after update as
begin
update master set master.due_amount=master.due_amount-student.st_pay
where exists (select st_pay from inserted as d
where d.st_name = master.st_name)
end


update student set st_pay=200
where st_name='ankit'

ankit

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-31 : 08:07:09
The trigger code should be

update m set m.due_amount=m.due_amount-d.st_pay
from master as m inner join inserted as d on d.st_name = m.st_name


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ankitkumar
Starting Member

2 Posts

Posted - 2009-10-31 : 08:34:20
thanks sir its done...
now can you help me in using this trigger in c# ado.net program

ankit
Go to Top of Page
   

- Advertisement -