-- Migration: 043_CreateResetPartialSearchesProcedure
-- Source: OLD/Database/StoredProcedures/ResetPartialSearches.sql
-- Resets searches that were started but not completed (cleanup after crash)

CREATE OR ALTER PROCEDURE [dbo].[ResetPartialSearches]
AS
BEGIN
    -- Reset status and start timestamp for searches begun but not finished
    UPDATE dbo.Search
    SET Status = 1,
        StartDT = NULL
    WHERE StartDT IS NOT NULL
      AND EndDT IS NULL;
END
GO
