Skip to main content
May 21, 2024
Question

Default value in database not populating

  • May 21, 2024
  • 3 replies
  • 0 views

Hi there, 

 

I have created a table in the DB with a default value of current timestamp for a dateTime column. However when i try to write to it using a CDT the default column is null.

Table structure. 

CDT definition.

Any help would be appreciated [emoticon:c4563cd7d5574777a71c318021cbbcc8]

    3 replies

    mikes0011
    Brainy
    May 21, 2024

    AFAIK the "default value" for a column (when we're talking about the SQL table definition) only applies when adding that column to an existing table with existing entries - and perhaps some other aspects of directly adding new rows to the table directly via SQL commands and/or in the PHPMyAdmin interface - but it has no bearing on what happens when you create new rows in a process (nor does Appian have any insight into what the SQL "default" setting is set to).

    Long story short: you'll need to manually populate that value when creating rows in Appian, as always.

    The Expression Guru
    stewart.burchell
    May 21, 2024

    It's probably of no consolation but this *does* work if you use the modern Write Records smart service i.e. the default value (for the 'MODIFIED_ON' column in my test example) is set to the value of 'current_timestamp(6)'

    mikes0011
    Brainy
    May 21, 2024

    ooh, nice.

    The Expression Guru