mysql table

--insert into lcbtest.sys_ddschema(objName,enName,propertyType)
--SELECT table_name,table_name,table_schema FROM `information_schema`.`TABLES`  WHERE `TABLE_SCHEMA`='lcbtest';
--SHOW CREATE TABLE `lcbtest`.`accountinfo_actaccount`;
--SHOW CREATE TABLE `lcbtest`.`cardinfo`;

--desc `lcbtest`.`accountinfo_actaccount`

select * from information_schema.`COLUMNS` where TABLE_SCHEMA='lcbtest' and TABLE_NAME='accountinfo_actaccount';

select * from information_schema.`COLUMNS` where TABLE_SCHEMA='lcbtest' and TABLE_NAME in(SELECT table_name FROM `information_schema`.`TABLES`  WHERE `TABLE_SCHEMA`='lcbtest');

 //put all table schema in dic

insert into lcbtest.sys_ddschema(schemaname,objName,enName,dataType,len,orders) select table_schema,table_name,column_name,data_type,character_maximum_length,ordinal_position from information_schema.`COLUMNS` where TABLE_SCHEMA='lcbtest' and TABLE_NAME in
(SELECT table_name FROM `information_schema`.`TABLES`  WHERE `TABLE_SCHEMA`='lcbtest');

猜你喜欢

转载自ssydxa219.iteye.com/blog/1933470