Search code examples
sqlmaster-data-services

How to delete records on MDS using SQL code?


I am trying to delete records on MDS using the staging table, and although I already updated the records to the ImportType 4 (Delete record):

Leaf Staging Table

On MDS it appears not only the correct line (Code 29355) but also the other ones that should have been deleted:

enter image description here


Solution

  • Solution found:

    Instead of updating only the ImportType value in Leaf Staging Table with 4 the ImportStatus_ID must also be updated to 0.

    ! Be careful: one of the errors raised was related with deleting members that had already been deleted --> To correct this, it was added to the update statement referred above the condition of only updating to (ImportType = 4, ImportStatus_ID = 0) the records that have the ImportType = 0 (new members).