SQL Server data Import

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.