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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 regarding triggers

Author  Topic 

kanika.bhagat
Starting Member

1 Post

Posted - 2010-10-11 : 14:41:28
hi,
I have one table student and three fields mtt1,mtt2 and sum.I want to update sum field whenever there is a ndefination for the table student is given below:
defination for the table student is given below:
create table "student"
(
"rollno" varchar2(4000),
"class" varchar2(4000),
"sem" varchar2(4000),
"sub" varchar2(4000),
"mtt1" number,
"mtt2" number,
"external" number,
"tot" number,
)
output will be like
if we insert values in all the fields such as
rollno - 08ejccs034
class -1csa
sem-1st
sub-maths
mtt1-7
mtt2-8
external-50
then total will be generated automatically like
tot-65
and I want to do this

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-11 : 14:42:56
Why don't you use a computed column instead?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-10-12 : 04:28:12
Or a VIEW (which would be my preference as IME computed columns can interfere with other things alter on - like Instead Of Triggers
Go to Top of Page
   

- Advertisement -