Use BULK Insert Bulk Import data sqlserver_mssql

Source: Internet
Author: User
Tags bulk insert
Straight to the point, directly with the example introduction:
Copy Code code as follows:

CREATE TABLE [dbo]. [Course] (
[ID] [int] NULL,
[Name] [nvarchar] (m) NULL,
[Coursetype] [nvarchar] (m) NULL,
[Course] [Float] Null
)

Import data:
Save the following data as a text file or SQL file
2, Li Gang, Chinese, 89;3, Li Gang, maths, 79;3, Li Gang, English, 69;4, Li Gang, chemistry, 89
Import statement:
Copy Code code as follows:

BULK INSERT Dbo.course
From ' D:\course.txt '
With
(
FieldTerminator = ', ',
Rowterminator = '; '
)

For examples of BULK inserts, see:
    • BULK INSERT (Transact-SQL)

    • Bulk Import and export XML document example

    • to copy data between different collations

    • Preserve identity values when bulk import data

    • Preserve Null values or use default values during Bulk import

    • Specify field terminator and line terminator

    • Bulk-Import data using a format file

    • Import or export data using character formatting

    • Import or export data using native format

    • Import or export data using Unicode character format

    • Import or export data using Unicode native format

    • Skip table columns using a format file

    • Use a format file to map table columns to data file fields

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.