Queries to Delete Software Requests from Software Portal

book

Article ID: 171155

calendar_today

Updated On:

Products

Software Management Solution

Issue/Introduction

Software Requests should be automatically deleted after 15 days; however, sometimes they remain for years, possibly due to old defects that prevented them from being deleted.

Resolution

The following SQL query should delete all the software requests:
INSERT INTO ItemToDelete
SELECT SWP_SoftwareRequest.Guid, GETDATE()-1
FROM SWP_SoftwareRequest

Run the NS.Quarter-Hour task from Task Scheduler on the NS to process the ItemToDelete table.

Some of the requests may fail to be deleted due to references. Run the following queries IN ORDER to delete them from the Item table and then the SWP_SoftwareRequest table:

DELETE I FROM Item AS I
INNER JOIN SWP_SoftwareRequest ON SWP_SoftwareRequest.Guid = I.GUID

TRUNCATE TABLE SWP_SoftwareRequest