Modify data with stored procedures

Some tables in Dynamics 365 do not allow direct updates using the UPDATE statement. In these cases, updates are performed through stored procedures. Devart ODBC Driver for Dynamics 365 provides two stored procedures — AssociateRequest and DisassociateRequest — to modify data in tables. These stored procedures require a set of input parameters, as outlined below.

AssociateRequest stored procedure

The AssociateRequest stored procedure creates an association between two entities.

Input parameters

Parameter Description
entityName1 The name of the target table to which associations will be added.
entityId1 The ID of the target table to which associations will be added.
relationship The name of the relationship to use for the association.
entityName2 The name of the entity to relate to the target table.
entityId2 The ID of the entity to relate to the target table.

DisassociateRequest stored procedure

The DisassociateRequest stored procedure removes an association between two entities.

Input parameters

Parameter Description
entityName1 The name of the target table from which associations will be removed.
entityId1 The ID of the target table from which associations will be removed.
relationship The name of the relationship to use for the disassociation.
entityName2 The name of the entity to disassociate from the target table.
entityId2 The ID of the entity to disassociate from the target table.

Example

To associate an entity with the target table, you can use the AssociateRequest stored procedure.

CALL AssociateRequest('mai_mfilesquote', '8229F5C2-FBFC-EA11-B9B1-005056974312', 
                      'mai_relationship_mfilesquote_account', 'account', 
                      '9553B0C7-3491-E911-8120-005056A1191A');