Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    New York

    Unanswered: datetime column formula

    Hello all:

    Using EM to add a column Date_Entered with data type dateTime, what is the syntax to default the date to current date when record is added and to ensure it does not update if the record is modified at some other time in the future. Is it also possible to exclude the time when the column is updated (instead of 4/18/2003 9:32:56 PM the colum would be derived as 4/18/2003)

    Is there a publication with listing of all legal suntax used in SQL2000?

    Thank you

  2. #2
    Join Date
    Oct 2001
    bol has the syntax.

    I don't advise using e-m to update the schema.

    The sql would be something like

    alter table x add dte datetime not null default convert(varchar(8),getdate(),112)

    The column is not updated - only defaulted on insert.

    If you want it to be set to the current date on update you can do it in a trigger.

    Datetimes always include a time - the above will set it to midnight. It is up to you the format in which you display it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts