how to create and use fo trigger in sql 8

Posted by Shanky11 under Sql Server on 12/22/2012 | Points: 10 | Views : 723 | Status : [Member] | Replies : 3
i hav written this query.....................
my column name is hindi ,english ,economics ,computer ,accounts ,totalmarks and table name is marks
create trigger trg_insert on marks
for
insert
as
begin
update marks set totalmarks=hindi+english+accounts+computer+economics where s_id=1
print upper('Total marks saved')
end
but is is not firing trigger




Responses

Posted by: Sandeepmhatre on: 12/22/2012 [Member] Starter | Points: 25

Up
0
Down
http://sandeepmhatre.blogspot.com/2012/12/triggers-in-sql.html

Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/24/2012 [Member] Bronze | Points: 25

Up
0
Down
CREATE TRIGGER totalmarks ON score
FOR Insert
AS
Begin
UPDATE score set total = science+social+maths
End

Thanks
Pavan Kumar
Mark Answer if this fits the need

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/24/2012 [Member] Bronze | Points: 25

Up
0
Down
by giving where s_id=1 you are updating only one colum

Thanks
Pavan Kumar
Mark Answer if this fits the need

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response