ok I just need a very basic sql trigger and haven't been able to find an example on the net. please help.
here is the structure
table is vendor
namefield create_date update_date
--------- ----------- -----------
joeblow NULL 11/1/2004
janeblow NULL 11/3/2004
jacksmith NULL 11/2/2004
I need a simple trigger on an updating table
vendor. update_date date field. I simple need the trigger to copy the contents of the currently update update_date field and copy the same date into the create date field.
for example on the record joeblow I update the field update_date and then the trigger fired and now create_date also has the same date contents copied it into it. HOWEVER i only want to do the update if the contents of create_date is NULL.
i've gotten a start:
CREATE TRIGGER vendor_u
ON VENDOR
FOR UPDATE
AS
IF UPDATE(last_updated)
BEGIN
IF (SELECT last_update FROM updated
...
ANY IDEAS HOW TO FINISH, PLEASE HELP!
here is the structure
table is vendor
namefield create_date update_date
--------- ----------- -----------
joeblow NULL 11/1/2004
janeblow NULL 11/3/2004
jacksmith NULL 11/2/2004
I need a simple trigger on an updating table
vendor. update_date date field. I simple need the trigger to copy the contents of the currently update update_date field and copy the same date into the create date field.
for example on the record joeblow I update the field update_date and then the trigger fired and now create_date also has the same date contents copied it into it. HOWEVER i only want to do the update if the contents of create_date is NULL.
i've gotten a start:
CREATE TRIGGER vendor_u
ON VENDOR
FOR UPDATE
AS
IF UPDATE(last_updated)
BEGIN
IF (SELECT last_update FROM updated
...
ANY IDEAS HOW TO FINISH, PLEASE HELP!