Instead of always using the interface, I thought I would script the restore procedure. So, I tried this:
RESTORE DATABASE [LevelExtreme] FROM DISK = N'D:\Data\Level Extreme\LevelExtreme.bak'
WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
GO
But, I obtain this:
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'LevelExtreme' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
What else is missing in this script so I can execute it?