I have a working database consisting of a .mdf file and .log file on one computer.
I try to move it to another using the exact same setup, disks and paths.
On the new computer I start Microsoft SQL Server Management Studio and connect.
Here I try to "Attach" database and select the .mdf file in the dialog, but then I get an error saying:
An error occurred when attaching the database(s). click the hyperlink in the Message column for details
It even seems to crash the server. And it appears I need to reboot. Here are two screenshots. One before and after clicking "OK" and opening the message hyperlink which I had not seen before:
Before:
Error:
Note: The 2008 refers when I created the database. But it is running in SQL Server 2019 Express on the old computer.
... ALTERNATIVE METHOD ...
I figured I would try use backup/restore, but then I get an error about sector size being different.
I am using SSMS for this. But I have tried a few script adjustments SSMS generated. Here is what it generates by default when clicking "Script" button:
BACKUP DATABASE [SharewareSalesMS]
TO DISK = N'W:\b-databases\MsSql\2019-SSMS-BACKUP-NEWEST\SharewareSalesMS.bak'
WITH NOFORMAT, NOINIT,
NAME = N'SharewareSalesMS-Full Database Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO