Skip to main content
June 17, 2021
Question

Default Value for Columns are not working

  • June 17, 2021
  • 5 replies
  • 0 views

Hi All,

In MySQL/MariaDB, we have an option to default the column value while creating a table(For Example createdBy: System; createdOn: CURRENT_TIMESTAMP). In Appian, if we set those values to NULL and pass them to DB, those default values get initialized and stored in the appropriate table. This works fine in MySQL and MariaDB

However, Whilst tries the same in SQL Server, I don't see that the default values get triggered and stored into the fields. Should I add anything else for SQL Server DB? Did anyone face this issue before?

Note: I don't want to set the values in Appian and store them in DB. Instead, I need to handle it DB end.

Thanks in advance.

5 replies

gayathris111098
June 20, 2021

Hi,

I have not tried this approach on myself. Just a quick thought

Make sure user account you are trying has ALTER permission.

June 21, 2021

Hi melwyan,

Please check the following items.

1) Please review the DDL for the create table which is having the default value for that columns

Ex:ALTER TABLE table ADD datetime default CURRENT_TIMESTAMP

2)Verify by inserting the values into the table using from SQL server(backend) and see whether the default is working

3)if steps 1 and 2 are ok. then download and Verify the XSD. 

(If required please create a new cdt after altering the table with default and verify the datastore again)

Hope by using any of the above 3 steps then you can find out the cause and add the fix.

Please let me know in case of any challneges,

Thanks,Barat

June 23, 2021

Hi [mention:8b16b01a9461443eae27679fda5d25f2:e9ed411860ed4f2ba0265705b8793d05]

While I try to insert the value using the INSERT command via SSMS, I could see the default values get stored in the appropriate columns. However, after creating the CDT from the table and inserting the value from Appian, it's saving as NULL for those fields it must be saved with default values.

As I mentioned above, it works well in MySQL and MariaDB. Only in SQL server, I have been facing this issue

June 23, 2021

could you please take a look into the XSD/DDL. if possible, pls share DDL and XSD here.