--Clean Database Restore
USE master;
GO

-- If the database already exists, force it offline cleanly
IF DB_ID('Elyse_DB') IS NOT NULL
BEGIN
    ALTER DATABASE Elyse_DB
    SET SINGLE_USER
    WITH ROLLBACK IMMEDIATE;
END
GO

-- Restore the database exactly as per the backup
RESTORE DATABASE Elyse_DB
FROM DISK = 'F:\Elyse_DB_Backup_17-01-2026a.bak' -- CHANGE FILE PATH
WITH
    REPLACE,
    RECOVERY,
    STATS = 10;
GO

-- Put the database back into normal use
ALTER DATABASE Elyse_DB
SET MULTI_USER;
GO
