When ‘execute query’ activity is executed, it returns only a datatable without having default values.
If any default value is included in the output, UiPath Studio shows the error message.
Error Message:
“Execute query: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.”
I don’t get any error when the same query is executed on SQL editor…
Current Behavior:
When ‘execute query’ returns a datatable with default values, It gets the error.
(the defaults values are ‘0’ for the column ‘cancel’ and ‘0000-00-00’ for the column ‘cancelDate’),
For example
Query result without default values. (No error produced)
I found that Not Null + Default constraints don’t actually write the values on the rows and those columns have ‘Not Null’ and ‘Default’ for the constraints.
@Shin_Sam - Are these the only 2 columns in this table? Are there any other columns? Would you be able to share the table metadata? The error you see is just a simple SQL error complaining about duplicate data in a column which is supposed to have unique values. If you fix this so that no duplicate values are written to the columns with the unique constraints, then this issue will go away.
The ‘Not Null’ and ‘Default’ will not cause this error. There is another constraint on some column or columns in the table with a primary key or unique constraint which is getting duplicate data.