当前位置:网站首页>14、 Two methods of database export and import

14、 Two methods of database export and import

2022-07-07 23:10:00 Beyond proverb

One 、 With SQL Script format export ( recommend )

export

Right click the database to export , Mission —> Generation script
 Insert picture description here
next step
 Insert picture description here
Select the database to export , next step
 Insert picture description here
The content shall be modified as required , There is no need to go directly to the next step
 Insert picture description here
Check surface
 Insert picture description here
Check the table in the database to be exported
 Insert picture description here
Select the path and name of the script to save
 Insert picture description here
complete
 Insert picture description here
close
 Insert picture description here
Open the location where the script is located
 Insert picture description here
 Insert picture description here

Import

The first line of the script USE [fiber_yy]
So we need to manually create a file named fiber_yy The database of
 Insert picture description here
Click on New query choice fiber_yy database
 Insert picture description here
Copy all the script contents
 Insert picture description here
After clicking on perform
 Insert picture description here
You can see fiber_yy There are all the tables in the database

Two 、 With mdb File format export

export

 Insert picture description here
 Insert picture description here
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
 Insert picture description here
Copy these two files
For example, I copied to G Inside the plate
 Insert picture description here

Import

 Insert picture description here
Find the location of the database
 Insert picture description here
 Insert picture description here

 Insert picture description here
The permissions of these two files need to be modified
Right click .mdf file attribute
 Insert picture description here
If the report is wrong , You need to assign permissions to the parent folder
How to put it? , It is recommended to store it in C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA Under the path
Because this is Microsoft SQL Server Where the database is stored , Therefore, it has authority , There is no need to modify anything
 Insert picture description here
Just i You can import the database
 Insert picture description here

原网站

版权声明
本文为[Beyond proverb]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207072003319083.html