create table dbo.TbTrade
(
    tid                    bigint not null
        constraint PK_TbTrade
            primary key,
    tid_str                varchar(100),
    status                 varchar(100),
    type                   varchar(100),
    seller_nick            varchar(100),
    buyer_nick             varchar(100),
    created                datetime,
    oaid                   varchar(100),
    modified               datetime,
    trade_attr             varchar(500),
    adjust_fee             decimal(18, 2),
    alipay_no              varchar(100),
    alipay_point           int,
    available_confirm_fee  decimal(18, 2),
    buyer_alipay_no        varchar(100),
    buyer_area             varchar(100),
    buyer_cod_fee          decimal(18, 2),
    buyer_email            varchar(100),
    buyer_obtain_point_fee int,
    buyer_rate             int,
    cod_fee                decimal(18, 2),
    cod_status             varchar(100),
    coupon_fee             decimal(18, 2),
    commission_fee         decimal(18, 2),
    consign_time           datetime,
    discount_fee           decimal(18, 2),
    end_time               datetime,
    has_post_fee           int,
    has_yfx                int,
    is_3D                  int,
    is_brand_sale          int,
    is_daixiao             int,
    is_force_wlb           int,
    is_sh_ship             int,
    is_lgtype              int,
    is_part_consign        int,
    is_wt                  int,
    num                    int,
    num_iid                bigint,
    pay_time               datetime,
    payment                decimal(18, 2),
    pcc_af                 int,
    pic_path               varchar(200),
    point_fee              int,
    post_fee               decimal(18, 2),
    price                  decimal(18, 2),
    real_point_fee         int,
    received_payment       decimal(18, 2),
    receiver_country       varchar(100),
    receiver_state         varchar(100),
    receiver_city          varchar(100),
    receiver_district      varchar(100),
    receiver_town          varchar(100),
    receiver_mobile        varchar(100),
    receiver_address       varchar(500),
    receiver_name          varchar(100),
    receiver_zip           varchar(100),
    seller_alipay_no       varchar(100),
    seller_can_rate        int,
    seller_cod_fee         decimal(18, 2),
    seller_email           varchar(100),
    seller_flag            int,
    seller_mobile          varchar(100),
    seller_name            varchar(100),
    seller_phone           varchar(100),
    seller_rate            int,
    shipping_type          varchar(100),
    sid                    varchar(100),
    snapshot_url           varchar(100),
    title                  varchar(500),
    total_fee              decimal(18, 2),
    trade_from             varchar(100),
    createDT               datetime default getdate(),
    updateDT               datetime default getdate()
)
go

exec sp_addextendedproperty 'MS_Description', N'淘宝订单主表', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade'
go

exec sp_addextendedproperty 'MS_Description', N'交易编号', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'tid'
go

exec sp_addextendedproperty 'MS_Description', N'交易编号字符串', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'tid_str'
go

exec sp_addextendedproperty 'MS_Description', N'交易状态', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'status'
go

exec sp_addextendedproperty 'MS_Description', N'交易类型', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'type'
go

exec sp_addextendedproperty 'MS_Description', N'卖家昵称', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'seller_nick'
go

exec sp_addextendedproperty 'MS_Description', N'买家昵称', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'buyer_nick'
go

exec sp_addextendedproperty 'MS_Description', N'交易创建时间', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'created'
go

exec sp_addextendedproperty 'MS_Description', N'交易修改时间', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'modified'
go

exec sp_addextendedproperty 'MS_Description', N'交易属性', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'trade_attr'
go

exec sp_addextendedproperty 'MS_Description', N'卖家手工调整金额', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'adjust_fee'
go

exec sp_addextendedproperty 'MS_Description', N'支付宝编号', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'alipay_no'
go

exec sp_addextendedproperty 'MS_Description', N'支付宝积分', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'alipay_point'
go

exec sp_addextendedproperty 'MS_Description', N'买家支付宝', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'buyer_alipay_no'
go

exec sp_addextendedproperty 'MS_Description', N'买家区域', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'buyer_area'
go

exec sp_addextendedproperty 'MS_Description', N'买家邮箱', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'buyer_email'
go

exec sp_addextendedproperty 'MS_Description', N'买家获得积分', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'buyer_obtain_point_fee'
go

exec sp_addextendedproperty 'MS_Description', N'买家是否已评价', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'buyer_rate'
go

exec sp_addextendedproperty 'MS_Description', N'交易佣金', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'commission_fee'
go

exec sp_addextendedproperty 'MS_Description', N'子订单发货时间', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'consign_time'
go

exec sp_addextendedproperty 'MS_Description', N'系统优惠系统优惠金额', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'discount_fee'
go

exec sp_addextendedproperty 'MS_Description', N'交易结束时间', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'end_time'
go

exec sp_addextendedproperty 'MS_Description', N'含运费', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'has_post_fee'
go

exec sp_addextendedproperty 'MS_Description', N'运费险', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'has_yfx'
go

exec sp_addextendedproperty 'MS_Description', N'是否3D', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'is_3D'
go

exec sp_addextendedproperty 'MS_Description', N'是否品牌销售', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'is_brand_sale'
go

exec sp_addextendedproperty 'MS_Description', N'是否代销', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'is_daixiao'
go

exec sp_addextendedproperty 'MS_Description', N'是否发货', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'is_sh_ship'
go

exec sp_addextendedproperty 'MS_Description', N'是否是多次发货的订单', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'is_part_consign'
go

exec sp_addextendedproperty 'MS_Description', N'商品购买数量', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'num'
go

exec sp_addextendedproperty 'MS_Description', N'商品数字编号', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'num_iid'
go

exec sp_addextendedproperty 'MS_Description', N'付款时间', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'pay_time'
go

exec sp_addextendedproperty 'MS_Description', N'实付金额', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'payment'
go

exec sp_addextendedproperty 'MS_Description', N'图片', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'pic_path'
go

exec sp_addextendedproperty 'MS_Description', N'积分', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'point_fee'
go

exec sp_addextendedproperty 'MS_Description', N'邮费', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'post_fee'
go

exec sp_addextendedproperty 'MS_Description', N'商品价格', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'price'
go

exec sp_addextendedproperty 'MS_Description', N'实际积分', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'real_point_fee'
go

exec sp_addextendedproperty 'MS_Description', N'卖家实际收到的支付宝打款金额', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade',
     'COLUMN', 'received_payment'
go

exec sp_addextendedproperty 'MS_Description', N'国家', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_country'
go

exec sp_addextendedproperty 'MS_Description', N'省', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_state'
go

exec sp_addextendedproperty 'MS_Description', N'市', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_city'
go

exec sp_addextendedproperty 'MS_Description', N'地区', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'receiver_district'
go

exec sp_addextendedproperty 'MS_Description', N'镇', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_town'
go

exec sp_addextendedproperty 'MS_Description', N'手机', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_mobile'
go

exec sp_addextendedproperty 'MS_Description', N'收货人的详细地址', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'receiver_address'
go

exec sp_addextendedproperty 'MS_Description', N'收件人', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_name'
go

exec sp_addextendedproperty 'MS_Description', N'邮编', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'receiver_zip'
go

exec sp_addextendedproperty 'MS_Description', N'卖家支付宝账号', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'seller_alipay_no'
go

exec sp_addextendedproperty 'MS_Description', N'卖家是否可以对订单进行评价', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade',
     'COLUMN', 'seller_can_rate'
go

exec sp_addextendedproperty 'MS_Description', N'卖家邮箱', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'seller_email'
go

exec sp_addextendedproperty 'MS_Description', N'卖家备注旗帜', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'seller_flag'
go

exec sp_addextendedproperty 'MS_Description', N'卖家手机', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'seller_mobile'
go

exec sp_addextendedproperty 'MS_Description', N'卖家名称', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'seller_name'
go

exec sp_addextendedproperty 'MS_Description', N'卖家电话', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'seller_phone'
go

exec sp_addextendedproperty 'MS_Description', N'卖家是否已评价', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'seller_rate'
go

exec sp_addextendedproperty 'MS_Description', N'创建交易时的物流方式', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'shipping_type'
go

exec sp_addextendedproperty 'MS_Description', N'物流运单号', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'sid'
go

exec sp_addextendedproperty 'MS_Description', N'订单快照URL', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'snapshot_url'
go

exec sp_addextendedproperty 'MS_Description', N'交易标题', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'title'
go

exec sp_addextendedproperty 'MS_Description', N'商品金额', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN', 'total_fee'
go

exec sp_addextendedproperty 'MS_Description', N'交易内部来源', 'SCHEMA', 'dbo', 'TABLE', 'TbTrade', 'COLUMN',
     'trade_from'
go

改为postgresql