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.