The first method is the simplest:
(1) Find the installation directory of SQL Server... Microsoft SQL Server \ mssql.1 \ MSSQL \ data
(2) copy the files:. MDF and. LDF.
(3) copy the two files in step 2 to the data directory of the target server.
(4) Right-click Database-add-Select. MDF file-all the way to OK. OK! . For example:
This method is the easiest way to avoid errors, but the SQL Server service must be stopped when copying files, which is not allowed in many cases.
Method 2: Use Database Backup
(1) Right-click database instance-task-backup to record the target location
(2) copy the. Bak file to the backup directory of the target server
(3) Right-click Database-Restore database-enter the name of the target database (from the shortcut menu)-select the source device.
(3) Option-overwrite the database first
Note that the path "restored to" in this step must exist. Otherwise, the database will fail to be restored.
(4) OK. OK! .