Issue:
A Service Ticket was closed with the incorrect resolution code assigned. Can this be changed?
If this happens it is most likely due to the user editing that data, in which case we should not perform data repair. But in the event the issue is caused by a defect, we can repair it through the data.
Resolution:
The SQL script below will allow the resolution code to be updated on the service ticket.
--- Set the ticket number that needs changed and the correct resolution code for the ticket ---
declare
@Ticket_Number nvarchar(25) = '2003',
@Resolution_Code nvarchar(25) = '4 Replace';
--- change the number in the backup table name to the current case number ---
select * into sv_service_ticket_back_123457 from SV_Service_Ticket where Ticket_Number = @Ticket_Number;
--- To verify the update, you can comment out the update line and uncomment the select line. ---
--select rc.Resolution_Id,t.Resolution_Id,*
update t set t.Resolution_Id = rc.resolution_id
from SV_Service_Ticket t
Outer Apply (select Resolution_Id
from SV_Resolution
where Resolution_Code = @Resolution_Code) rc
where t.Ticket_Number = @Ticket_Number