sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Override System Default Value - Date Column

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Override System Default Value - Date Column

    The system defined default value for a date column in DB2/iSeries is always "current date". How can we change that to '01/01/0001' (*LOVAL) ?

    When I insert a record via RPGLE, the date fields always default to *LOVAL.
    Whereas, when I insert a record using SQL (or an ETL Tool like Informatica) it picks current date as the default value for the date field.


    Please note - Date field is defined as "NOT NULL WITH DEFAULT"

    I don't want to edit the DDS for each date field and manually override the default value. (using option DFT)
    Is there a way to override the default value for an entire DB Schema?

    Any ideas would be greatly appreciated.

  • #2
    Just set add the desired default value to the date field , i.e. NOT NULL DEFAULT '0001-01-01'
    If you won't add an explicit default value the current date is assumed as default value.

    I RPG it is different, because the I/O specs are initialized to the low value. As long as you won't explicitly override the date column in RPG, *LOVAL is taken.
    If you use a logical file (or an SQL index) in RPG which does not include the date field for the write operation, the default value specified within the table is also taken, i.e. if it is NOT NULL DEFAULT, the current date will be used.

    Birgitta

    Comment


    • #3
      However, I want this change implemented over an entire DB schema. So you say the only option I have is to explicitly override the default value for each date field in each file?

      Comment

      sponsored links

      Collapse

      Working...
      X