您的位置:首页 > 数据库 > MySQL

MYSQL创建多张表,相同表结构,不…

2016-01-29 10:26 459 查看
#!/bin/bash

for i in {0..63}

do

mysql -u$1 -p$2 -h127.0.0.1 <<EOF

       
use yoon;

create table ivc_pre_detail_$i

(

  
id                  
bigint not null,

  
refId               
bigint,

  
detailType          
smallint,

  
wid                 
int comment '商品编号',

  
wname               
varchar(150) comment '商品名称',

  
num                 
int comment '商品数量',

  
price               
decimal(16,6) comment '商品价格',

  
unit                
varchar(10) comment '商品单位',

  
spec                
varchar(50) comment '规格型号',

  
taxRate             
decimal(16,6),

  
uuid                
varchar(50) comment '防重唯一标识',

  
createTime          
datetime comment '创建时间',

  
hashTime            
datetime comment '分库时间',

   primary key (id)

) ENGINE=InnoDB DEFAULT CHARSET=UTF8;

alter table ivc_pre_detail_$i comment '普票临时预开明细';

EOF

done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: