Import fixed format txt text data to the SQL Server database, servertxt

Source: Internet
Author: User

Import fixed format txt text data to the SQL Server database, servertxt

When the amount of text data is large, it is basically impossible to input a single piece of data. It is also very troublesome to write a program to transfer it. Fortunately, SQL server provides a simple method.

Bulk insert TABLE name from 'C: \ your partition file .txt 'with (FieldterMinator = 'use what symbol to separate data', RowterMinator = 'add \ n to what symbol ') -- \ n indicates the carriage return symbol, which is the symbol before the carriage return. If there is no symbol, the single quotation mark \ n Bulk insert # temp from 'C: \ test.txt 'with (FieldterMinator = ', ', RowterMinator =' \ n'condition --w.tempis the table name. In drive C, test.txt and FieldterMinator = ',' each data is separated by a comma, and RowterMinator = '\ n' each line of data ends with a carriage return.

It is easier to import fixed-format text data than mysql SQL code.

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.