Thursday, September 17, 2009

triggers with a computed column insertion

I had the problem of inserting a row from a table to another because of a computed column cannot have a explicit value on a insert statement. Then I realize i had to take off the name of the column (computed column) in order to insert the row. I make sense , but since I'm pretty scat this things could happen.


the error was resolved with the following trigger code:

CREATE TRIGGER insertanotaVario

on NotaIngreso

SET IDENTITY_INSERT Nota ON
select (idnota,notadescripcion, curso1, curso2, curso3)
FROM INSERTED
SET IDENTITY_INSERT Nota OFF



// Note: do not add the field that is the average calculated from the column(computed column).





No comments: