For ACC - You can write a SQL Script with the 'DELETE FROM <<tablename>> WHERE <<pk>> IS NULL
For ACS -
1. Create a duplicate custom resource.
2. Publish your changes
3. Load non-null pk records from your table here.
4. Mark the table for re-draft ( more details here: Deleting a resource ) This will delete ALL the records for the table when you publish.
5. Got ahead a publish
6. Do not delete the resource, instead unselect the re-draft and publish once again. This will leave the resources but without any records.
7. Load the data that you backed up before to the original table
8. Delete the backup table ( same steps as detailed in the link above).
9. Don't let bad data get into the system again
Thanks,
Pulkit