Walker's needs are simple enough to import SQL files that contain multiple INSERT statements. began to think that BCP should be used, because vaguely, "SQL Server uses BCP for large amounts of data replication." However, Walker found that BCP does not support standard SQL file import. Walker's final choice is sqlcmd. Now the contents of the lookup are listed below.
First, sqlcmd
1, Basic command.
Sqlcmd-s servername-u username-p password-d databasename-i filename.sql
Filename.sql is a multi-line standard SQL statement.
Example:
Sqlcmd-s192.168.0.169-u "sa"-P "sapwd"-D "DatabaseName"-I D:\tmp\t.sql
As noted in the official documentation: currently (2015.8.27), SQLCMD does not require spaces between command-line options and values. However, in a future release, spaces may be required between the command-line options and the values.
Official Document: SQLCMD Utility
Second, bcp
Standard SQL file import not supported?
Related reading:
1. Official Documentation: BCP utility
2. Summary of SQL Server bcp usage
3. SQL Server uses BCP for large data export import
4. SQL Server BCP import and export data
Third, osql
The official documentation (osql utility) mentions that this feature will be removed in future versions of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use SQLCMD instead.
Walker * * *
This article is from "Walker's Journal" blog, please be sure to keep this source http://walkerqt.blog.51cto.com/1310630/1688927
SQL Server data Import