HI,
I am trying to return automatic value into another column with using trigger in a table, when I enter new record into that table. It works if it is first data to be in that table. If I have more than one record already, it doesn’t work. I thing it says “more than one value has been returned….”. How can I prevent that? For example; if I am 5th row trigger only read that row instead of all rows. I can’t do that.
CREATE TRIGGER exam_note ON dbo.exam
FOR insert
AS
DECLARE @note decimal(10,2)
select @note = (SELECT e_score FROM exam)
IF ( @note >=0 and @note<=50 )
update exam set e_note='Half'
else IF( @note >=51 and @note<=100 )
update exam set e_note='Full'
Thanks,