A .NET Framework error occurred during execution of user-defined routine or aggregate "USP_CONFIGURATIONDATAIMPORT_IMPORTDATA": System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ADHOCQUERY_QUERYCATEGORYCODEID", The conflict occurred in database "XXXX_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", table "dbo.QUERYCATEGORYCODE, column "ID". The statement has been terminated. System.Data.SqlClient.SqlException: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlCommand.RunExecuteNonQuerySmi(Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult.result, String methodName, Boolean sendToPipe)
This error occurs if the Configuration export does not contain the Query Category Code Table is not located above AdHoc Query in the hierarchy. To correct this error export the configuration data with this modification.
Steps: 1) Navigate to the Configuration Export 2) Edit the process under "Tasks". 3) Under Export instances, select "Code Tables". 4) Drag the "Code Table" field to the selected types. 5) From the Code tables drop down select "Query Category". 6) Place the Code table above the AdHoc Query in the hierarchy. 7) Save.