I built a table date20170801A at present, the existing field code like this:
[code=SQL] CREATE TABLE ` date20170801A ` (
` TranID ` varchar (255) the DEFAULT NULL COMMENT 'order no.,
` Time ` varchar (255) the DEFAULT NULL COMMENT 'closing Time,
` Price ` varchar (255) the DEFAULT NULL COMMENT 'clinch a deal the Price,
` Volume ` varchar (255) the DEFAULT NULL COMMENT 'clinch a deal the number of shares,
` SaleOrderVolume ` varchar (255) the DEFAULT NULL COMMENT 'number of seller's deity,
` BuyOrderVolume ` varchar (255) the DEFAULT NULL COMMENT 'number of buyer's deity,
` Type ` varchar (255) the DEFAULT NULL COMMENT 'transaction Type,
` SaleOrderID ` varchar (255) the DEFAULT NULL COMMENT 'number seller deity,
` SaleOrderPrice ` varchar (255) the DEFAULT NULL COMMENT 'the seller to hang the unit price,
` BuyOrderID ` varchar (255) the DEFAULT NULL COMMENT 'number buyer deity,
` BuyOrderPrice ` varchar (255) the DEFAULT NULL COMMENT 'buyer to hang the unit price'
) ENGINE=MyISAM DEFAULT CHARSET=GBK;
Questions as follows:
How do I put it in more than 3000 date20170801A CSV import table, and the table automatically add two fields used to identify the folder name and file name

Hope ace to help me solve the great god, no matter how to even give a concrete train of thought, thank you!
File price inside the CSV file header has created tables in mysql with me date20170801A field is consistent with the
CodePudding user response:
To table date20170801A added two fields is not ok, if is a Java can be directly get the file path and filename, save data when put together, other language estimation is also similarCodePudding user response:
I've tried, can not ahCodePudding user response:
MYSQL is not very familiar with, if is MS SQL Server, can consider to use filestream, for file operations,CodePudding user response:
# the initial increase in two fields
The alter table date20170801A add column folder_name varchar (20);
The alter table date20170801A add column file_name varchar (20);
# for each file to import, use the following method
The LOAD DATA INFILE 'import documents'
INTO the TABLE date20170801A
(corresponding to the file content field list)
SET folder_name='directory name, file_name=' file name ';
CodePudding user response:
As for the LOAD DATA of specific requirements (for example, to specify a newline, etc.), refer to the website LOAD DATA of grammarCodePudding user response: