Home > database >  How to make the program itself quickly import large quantities of text data to a table
How to make the program itself quickly import large quantities of text data to a table

Time:10-26

PB9 + asa, 2 million pieces of text data, have good formatting, use datawindow importfile, speed is slow, a little more than a hour to 200000 or so, I can't back down, be afraid of crash; Write a script from a text line read and use the INSERT statement is inserted INTO the list, speed is about the same, more than a hour to 300000 or so, also slowly, if it's not PB programming scripts, in the interactive SQL tool, using the LOAD INTO TABLE statement was quickly, but can only manual import, but I need to use the program timing automatically import millions of rows of data every day, what's the quick way? Thank you, I tried the LOAD INTO TABLE statement to ISQL statements, PB does not support script,

CodePudding user response:

In pb, USES importfile is the fastest way to import, you can put the file into several, then direct import

CodePudding user response:

With processing can also be directly
 @ echo off 
Set the path=D: \
The set ls_dbn=% ~ n1
The set ls_server COMPUTERNAME=% %;
Connection string: : databasename ls_dbn=% %; Server=% ls_server %;
The set ls_connstr=userid=dba; Password=SQL; Databasefile=% 1;
The set ls_left=dbisqlc12 - c % ls_connstr % - q
: : set the separators and character set
The set ls_end=DELIMITED BY ', 'ENCODING' utf-8 '
: : echo start the engine and open the database...
: : dbisqlc12 - q "START ENGINE as' % % ls_server STARTLINE 'dbeng12 - c 8 m'"
: : dbisqlc12 - q "start as % ls_dbn % on the database % 1 '% % ls_server AUTOSTOP OFF"
Echo start the engine and connect to the database...
Dbisqlc12 AutoStop ls_connstr - c % %=OFF; - q "select 1
"Echo the delete from SALE_BARCODE...
% % ls_left "delete from SALE_BARCODE"
: : % ls_left % "LOAD TABLE SALE_BARCODE (BC_BARCODE1 BC_CLOTHNO, BC_COLOR, BC_SIZE, BC_UPDATETIME, BC_UPDATEMAN) FROM ls_end % % 2%"
: : echo the LOAD TABLE SALE_CLOTH
% % ls_left "LOAD TABLE SALE_CLOTH (CT_ID, CT_STYLEID CT_NAME, CT_SIZETYPE, CT_PRICE, CT_QH, CT_UPDATETIME, CT_UPDATEMAN) FROM ls_end % % 3%"
: : stop database
: : dbstop12 ls_dbn - y % %
: : dbisqlc12 - q "stop ls_dbn database % % on '% ls_server %'"
: : dbisqlc12 - q "stop ENGINE '% ls_server %'"
Dbstop12 ls_connstr - c % %

CodePudding user response:

@ xiajinxian: hello, this is just the way I want, but don't quite understand, the meaning of each parameter and fill method can you explain it in detail, thank you, for example, % 2 is said to import file path and file name in detail

CodePudding user response:

reference loosong reply: 3/f
@ xiajinxian: hello, this is just the way I want, but don't quite understand, the meaning of each parameter and fill in the way can you explain it in detail, thank you, for example, % 2 is said to import file path and file name

This is a bat file, 1% is the first parameter is a bat db files address
The grammar of the concrete can know about the other batch

CodePudding user response:

Bat file syntax which you learn?
  • Related