The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

Pada posting kali ini akan dibahas cara mengatasi error "The DELETE statement conflicted with the REFERENCE constraint 'FK_subplan_job_id'" pada saat kita akan menghapus job di SQL Server.

Error diatas disebabkan adanya relasi antara tabel-tabel sysmaintplan sehingga kita harus menghapus relasi tersebut pada level pada tabel paling bawah.


The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

Dibawah ini adalah langkah-langkah sebelum menghapus job tersebut :


  1. Cari ID plan dengan query dibawah ini

    SELECT name, id FROM msdb.dbo.sysmaintplan_plans

  2. Hapus plan_id dari tabel msdb.dbo.sysmaintplan_log untuk plan_id pada poin 1.

    DELETE FROM msdb.dbo.sysmaintplan_log WHERE plan_id = 'AC1514E8-E14F-4468-B923-9FB05395112C'

  3. Hapus plan_id dari tabel msdb.dbo.sysmaintplan_subplans untuk plan_id pada poin 1.

    DELETE FROM msdb.dbo.sysmaintplan_subplans WHERE plan_id = 'AC1514E8-E14F-4468-B923-9FB05395112C'

  4. Hapus plan_id dari tabel msdb.dbo.sysmaintplan_plans untuk plan_id pada poin 1.

    DELETE FROM msdb.dbo.sysmaintplan_plans WHERE id = 'AC1514E8-E14F-4468-B923-9FB05395112C'

  5. Hapus job melalui SQL Server Management Studio.



The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

Semoga posting tentang "The DELETE statement conflicted with the REFERENCE constraint 'FK_subplan_job_id'" diatas dapat bermanfaat.


Salam,




Popular posts from this blog

Permission Rule In SharePoint List or Library

Audits Or Change Data Capture In SQL Server

Login failed for user (Microsoft SQL Server, Error: 18456)