Re: How do I do this (SQL & Triggers)??
Posted in 1996
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
John Gose wrote: > > I need to have an insert trigger which checks to see if a particular > field is NULL. If this field is NULL, I need to have it made equal > to the value of another field from the same row. Having putzed > around with this for a while using a combination of triggers and > stored procedures, I am beginning to believe that it is not possible. > Tell me it ain't so. This seems to be the topic of the month. We have established that when the insert trigger passes control over to you, the insert has already happened. The record we can access is the record that has just been inserted. So what about an UPDATE at this point if your field is NULL? Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+