Export/import database
Usually there are two ways to export SQLServer database:
1. Export as SQL file
2. Export as mdf and ldf database files
1. In the form of SQL files
1.1 Export
The export method of SQL file usually needs to customize the separator between columns, because the default separator "," is likely to appear in the value of the column
1.2 Import
Simply copy the content in the export file to the new query execution
2. In the form of mdf and ldf database files
2.1 Export
Perform the following operations in sqlserver management studio
2.1.1 Offline
(Right-click tasks -> take offline for the selected database) Note that this will cause the database to be currently unavailable
2.1.2 To the data path of the database, copy out the mdf and ldf files
The default data path of sqlserver:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA
My path:
E:\APP\sqlserver\MSSQLSERVER\MSSQL10_50.MSSQLSERVER\MSSQL\DATA
2.1.3 Set the original database to the online state to be used normally
2.2 Import the database (remember to open the control authority before importing)
2.1 Right click on the database and click Attach
2.2 Click to add
3. What is separation
To separate a database is to delete a database (such as student_Mis) from the SQL Server database list so that it is no longer
managed and used by SQL Server, but the database file (.MDF) and the corresponding log file (.LDF) are intact . After the separation is successful, we can copy the database file (.MDF) and the corresponding log file (.LDF) to other disks as a backup.