Data can be imported to and exported from instances of Microsoft® SQL Server™ using several SQL Server tools and Transact-SQL statements. You can also write your own programs to import and export data using the programming models and application programming interfaces (APIs) available with SQL Server.
You can copy data to and from instances of SQL Server by:
For more information, see DTS Tools.
The replication technology in SQL Server allows you to make duplicate copies of your data, move those copies to different locations, and synchronize the data automatically so that all copies have the same data values. Replication can be implemented between databases on the same server or different servers connected by LANs, WANs, or the Internet.
For more information, see Replication Overview.
For more information, see Distributed Queries.
For more information, see INSERT.
For more information, see BULK INSERT.
For more information, see SELECT.
The method chosen to import or export data depends on user requirements, for example:
This table describes the capabilities of various import and export options in SQL Server.
Required functionality |
DTS wizards |
Replication |
bcp |
BULK INSERT |
SELECT INTO/ INSERT |
---|---|---|---|---|---|
Import text data | YES | YES | YES | YES 1 | |
Export text data | YES | YES | |||
Import from ODBC data sources | YES | YES | |||
Export to ODBC data sources | YES | YES | |||
Import from OLE DB data sources | YES | YES | YES (1) | ||
Export to OLE DB data sources | YES | YES | YES | ||
Graphical user interface (GUI) | YES | YES | |||
Command prompt/batch scripts | YES | YES | YES | ||
Transact-SQL scripts | YES | YES | YES | ||
Automatic scheduling | YES | YES | YES 2 | YES 2 | |
Ad hoc import/export | YES | YES | YES | YES | |
Recurring import/export | YES | YES | YES | ||
Maximum performance | YES | YES | |||
Data transformation | YES | ||||
Programmatic interface | YES | YES | YES |
1 Using a distributed query that retrieves data from an external source by using an OLE DB provider.
2 By explicitly creating a job scheduled using SQL Server Agent.