Import fixed-format txt text data to a SQL Server database

Source: Internet
Author: User
Tags bulk insert

When the amount of text data is relatively large, the input of a strip is basically impossible, and writing a program to relay it is also very troublesome, fortunately SQL Server provides a relatively concise method.

Bulk Insert table name from ' C + + your text file. txt ' with (fieldterminator = ' What symbol to split the data ', rowterminator= ' with what symbol plus \ n End ')  --\n is the meaning of a carriage return, is the carriage return front is what symbol, if unsigned direct single quotation mark \ n Bulk insert #temp from ' C:\test.txt ' with (FieldTerminator = ', ', rowterminator= ' \ n ')--#temp是表名 , Test.txt,fieldterminator = ', ' Each data is separated by commas, and rowterminator= ' \ n ' Each row of data ends with a carriage return.

Easily handle fixed-format text data import, which is more concise than MySQL's SQL code.

Import fixed-format txt text data to a SQL Server database

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.