SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Report subscription deletion failed due to FK constraint


Report subscription deletion failed due to FK constraint

Author
Message
roni.vered
roni.vered
SSC-Enthusiastic
SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)

Group: General Forum Members
Points: 119 Visits: 815
Hi all,

We have many SSRS report timed subscriptions (SQL Server 2008R2 SP4).
One of our report developers tried to delete a report subscription, and got the following error:

An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. (rsReportServerDatabaseError) Get Online Help The DELETE statement conflicted with the REFERENCE constraint "FK_ReportSchedule_Subscriptions". The conflict occurred in database "ReportServer", table "dbo.ReportSchedule", column 'SubscriptionID'. The statement has been terminated.


I solved the issue by manually deleting the schedule record from the ReportServer.dbo.ReportSchedule table.

The steps were the following:

1. Find the relevant subscription that needs to be deleted.

SELECT sub.SubscriptionID, 
rs.ScheduleID,
SUB.[Description]
,SUB.EventType
,SUB.DeliveryExtension
,SUB.LastRunTime
FROM dbo.Subscriptions AS SUB
INNER JOIN dbo.Users AS USR ON SUB.OwnerID = USR.UserID
INNER JOIN dbo.ReportSchedule AS RS ON SUB.Report_OID = RS.ReportID AND SUB.SubscriptionID = RS.SubscriptionID
WHERE SUB.Description like '%Mail reciepient here%'
ORDER BY sub.Description



2. Find the relevant schedule that prevents the record from being deleted.

SELECT  [ScheduleID]
,[ReportID]
,[SubscriptionID]
,[ReportAction]
FROM [ReportServer].[dbo].[ReportSchedule]
WHERE SubscriptionID = 'GUID HERE'



3. Backup the table

SELECT * 
INTO [ReportServer].[dbo].[ReportScheduleBackup]
FROM [ReportServer].[dbo].[ReportSchedule]



4. Delete the schedule

DELETE FROM [ReportServer].[dbo].[ReportSchedule]
WHERE ScheduleID ='GUID HERE'



The delete command deleted the schedule AND deleted the job from SQL instance that holds the RS databases. That job triggered the timed subscription.

After that, I could delete the report timed subscription from the reports web GUI.

My questions -

- Why a manual deletion was needed in the first place ?
- Why couldn't I delete the report subscription form the RS GUI?
(http://REPORTSERVER_NAME/Reports/Pages/Subscriptions.aspx)

Thanks,
Roni.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search