Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserted table in triggers

Status
Not open for further replies.

dspace

Programmer
Feb 5, 2002
9
US
Is it possible to change the value of a field in the inserted record in a trigger?

I've tried "update inserted" and it won't let me do that.

Thanks.
 

INSERTED is just an instrinsic temp table and will go out of scope when the trigger has finished. If you are trying to do something with the table the trigger is working on, then link the INSERTED table on the PK and update the column in the base table.

If you want to intercept the value before it gets inserted/updated/deleted in the base table, make the trigger an INSTEAD OF (before) rather than a FOR (after). For the before trigger, you will have to provide the insert, update or delete code yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top