In Microsoft Dynamics 365 Finance & Operations, SSRS reports are deployed to the SSRS server and stored in the ReportServer database. While reports are typically managed through Visual Studio and deployment pipelines, there are situations where you may need to manually remove a report directly from the SSRS database.
This article walks through a safe and structured way to delete an SSRS report from SQL Server Reporting Services.
⚠️ Important Considerations
Before proceeding:
- Always take a backup of the ReportServer database.
- Avoid deleting records directly in production unless absolutely necessary.
- Ensure the report is not required by any active processes.
- Prefer standard deployment cleanup where possible.
Step 1: Connect to the ReportServer Database
- Open SQL Server Management Studio (SSMS).
- Connect to your SQL Server instance.
- Locate the ReportServer database (commonly named
ReportServerorDynamicsAXReportServer). - Right-click the database → New Query.
Step 2: Identify the Report in the Catalog Table
All SSRS reports are stored in the Catalog table.
Use the following query to locate your report:
SELECT * FROM Catalog WHERE Name LIKE '%<ReportName>%'
This query returns:
- Report name
- ItemID (important for dependencies)
- Path and metadata
Step 3: Check for Dependencies in DataSource Table
Before deleting the report, check whether it has related entries in dependent tables such as DataSource.
SELECT *
FROM DataSource AS t
WHERE t.ItemID IN ('<ItemID1>', '<ItemID2>')
The ItemID values come from the results of the Catalog query.
Step 4: Delete Dependent Records
If records exist in the DataSource table, delete them first to avoid orphaned references.
DELETE t
FROM DataSource AS t
WHERE t.ItemID IN ('<ItemID1>', '<ItemID2>')
You can also delete a single dependency:
DELETE t
FROM DataSource AS t
WHERE t.ItemID = '<ItemID>'
Step 5: Delete Report from Catalog
Once dependencies are removed, delete the report from the Catalog table.
DELETE FROM Catalog
WHERE Name IN ('ReportName_Version1', 'ReportName_Version2')
Example
DELETE FROM Catalog
WHERE Name = 'SalesInvoice'
Step 6: Validate Cleanup
Run the following again to confirm deletion:
SELECT *
FROM Catalog
WHERE Name LIKE '%SalesInvoice%'
Also re-check dependencies:
SELECT *
FROM DataSource
WHERE ItemID = '<ItemID>'
Best Practices
- Use naming conventions to easily identify reports.
- Avoid direct DB deletion during active deployments.
- Use SSRS Web Portal or deployment tools when possible.
- Document any manual changes for audit purposes.
When Should You Use This Approach?
This method is useful when:
- A report is stuck or partially deployed
- Duplicate reports exist
- Deployment cleanup failed
- You need to remove legacy artifacts quickly
Final Thoughts
Directly modifying the SSRS ReportServer database should always be a last resort. However, when used carefully, this approach gives you precise control over report cleanup and helps resolve deployment inconsistencies in D365FO environments.
If you find yourself doing this often, it may be worth reviewing your deployment pipeline or report lifecycle management process.
No comments:
Post a Comment