mysql - Using LOAD DATA INFILE command in a stored procedure -
is possible @ all? read on few websites 1 can not use load data command inside procedure.
no, not possible due security reasons, suppose. however, can generate "load data" queries tables in database using trick (return series of queries each table: truncate table before load data, disable keys, load data, enable keys):
select concat('truncate table ',table_name,'; alter table ',table_name,' disable keys; load data infile "',table_name,'.txt" table ',table_name,' fields terminated "\\t" lines terminated "\\n"; alter table ',table_name,' enable keys; ') information_schema.`tables` infs infs.`table_schema`=database() , infs.`table_type`!='view';
after run query, rows resulted queries transferring data. use when moving full database content another. of course, in query can filter needed tables using more conditions. hope helps.
Comments
Post a Comment