CREATE PROCEDURE [dbo].[CompleteSearch2] (
     @p_SearchID INT,
     @p_WasSuccessful BIT,
     @p_Results VARBINARY(MAX)
    )
AS
    DECLARE @v_Status INT;

    BEGIN
		--Determine status code
        SET @v_Status = CASE @p_WasSuccessful
                          WHEN 1 THEN 3
                          ELSE 4
                        END;

		--Update search status and results
        UPDATE  dbo.Search2
        SET     Status = @v_Status,
                Results = @p_Results,
				EndDT = GETDATE()
        WHERE   ID = @p_SearchID;
    END