Reference: https://www.cnblogs.com/fuhaots2009/p/3464983.html
First, the example database introduction
- SOURCE database test_other_db: There are tb_class,tb_student,tb_testtable three tables.
- Target database testdb_output: Empty library with no tables.
Second, the example content introduction
Instance target:
- Import the table tb_class,tb_student from the source database test_other_db into the target database testdb_output.
Implementation method:
>> using the Export data task to implement
1 Open the Select Data Source window.
Set the data source to "SQL Server Native Client 10.0" or to a different data source.
Set the server name to "." (Local machine is server)
Authentication is set to "Use Windows Authentication" (can also be set to use SQL Server Authentication)
The database is set to "test_other_db" (the source database used in this experiment)
2 Click "Next" to go to the "Select Target" window.
Set the target to "SQL Server Native Client 10.0", where the table tb_class,tb_student in the source database test_other_db is imported directly into the target database testdb_output, so the target should also be set to "SQL Server Native Client 10.0".
Set the server name to "HP-HP" (this is the local machine name)
Identity authentication is also set to "Use Windows Authentication" (can also be set to use SQL Server Authentication)
Target database set to "Testdb_output" (target database used in this experiment)
3 Click "Next" to go to the "Specify Table copy or table query" window
Select Copy data for one or more tables or views (you can also write a query that specifies the data to be transferred)
4 Click "Next" to go to the "Select source table and Source view" window
Select Table Tb_class,tb_student
5 Click "Next" to go to the "Save and run Package" window
6 Click "Finish" to go to the "Complete the wizard" window, click "Finish" to display "Execution complete" window
7 View library Testdb_output, table tb_class,tb_student exists, and data is copied correctly.
>> using the Import data task to implement
In this example, the "Import data" task is no different from the "Export data" task, it can be implemented to import data from the source database test_other_db to the target database Testdb_output, but the starting point of the operation is different: "Import data" starting point in the target database, " Export data "starting point in the source database. The operating interface of the two operations is extremely similar, and this is not the case.
>> "Export" data to an Excel file or "Import" data from an Excel file
Implementing this is consistent with the approach described earlier, except that the target data source that you select when exporting data and the source data source that you select when importing data should be Microsoft Excel.
The source or destination data source can also be the item shown (only part of the display).
SQL Server 2008 Export data and import data task description