need curent date in column without changing third party app

  • We have a third party application that is inserting rows in a table. During the insert the application is putting NULLS in a create_date column. We need to have the current date in this column when this record is inserted. Because this is a third party application, we cannot get the code changed to use GetDate(). Of course a default value for this column will not work, because the insert of the NULL value in this column will override the default value constraint. I thought I could add a “check constraint” and could get this to work. I have tried several combinations using “case” with GetDate() with a check constraint and cannot get anything to work. I want to stay away from triggers, because this table is used in two different replications.

  • I don't think there is any way of doing this other than a trigger, and I'm not sure why the use of a trigger will affect the replications.

    Best wishes,
    Phil Factor

  • You are going to have to use triggers - there really is no other way. As long as the application is sending a value that is valid, that value will be stored.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply