Trigger Question

rmatthew

Well-known member
Joined
Dec 30, 2002
Messages
115
Location
Texas
Is it possible to change the value of an inserted item from within an insert trigger?

Such as
inserted.[field] = 1

There are several reasons, but one of them is to replace a value with a default if the value doesnt meet a FK Constraint so as to allow the insert to happen.
 
You cant update the "inserted" table and since the incoming row is violating the FK constraint it is not going to be allowed to be inserted. Your best bet is to adjust the FK value at the application or stored procedure level. There might be a gruesome hack out there somewhere though.
 
Back
Top