NC(65)元数据增加字段

以报销单主表er_bxzb表为例,增加15个字段字段以及两个其他业务所需字段

1、先在er_bxzb增加字段

增加字段


alter table er_bxzb add no_invoice char(1) default('N');

alter table er_bxzb add is_enabled_taxation_cloud char(1) default('N');

alter table er_bxzb add zyx31 nvarchar(101) default('~');
alter table er_bxzb add zyx32 nvarchar(101) default('~');
alter table er_bxzb add zyx33 nvarchar(101) default('~');
alter table er_bxzb add zyx34 nvarchar(101) default('~');
alter table er_bxzb add zyx35 nvarchar(101) default('~');
alter table er_bxzb add zyx36 nvarchar(101) default('~');
alter table er_bxzb add zyx37 nvarchar(101) default('~');
alter table er_bxzb add zyx38 nvarchar(101) default('~');
alter table er_bxzb add zyx39 nvarchar(101) default('~');
alter table er_bxzb add zyx40 nvarchar(101) default('~');
alter table er_bxzb add zyx41 nvarchar(101) default('~');
alter table er_bxzb add zyx42 nvarchar(101) default('~');
alter table er_bxzb add zyx43 nvarchar(101) default('~');
alter table er_bxzb add zyx44 nvarchar(101) default('~');
alter table er_bxzb add zyx45 nvarchar(101) default('~');

这里设置的默认值无效,数据库中字段显示还是null,不知为啥,有知道的,请留言指导,感谢!
在这里插入图片描述

删除字段

--删除字段,需先删除依赖。依赖如何知道,可以执行删除字段语句,会报错提示,这样就可以得到依赖了。
alter table er_bxzb  drop constraint DF__er_bxzb__no_invo__0D6BB239;

alter table er_bxzb drop column no_invoice;

  alter table er_bxzb  drop constraint DF__er_bxzb__is_enab__1E963E3B;

alter table er_bxzb drop column is_enabled_taxation_cloud;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx31__0F53FAAB;

alter table er_bxzb drop column zyx31;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx32__10481EE4;

alter table er_bxzb drop column zyx32;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx33__113C431D;

alter table er_bxzb drop column zyx33;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx34__12306756;

alter table er_bxzb drop column zyx34;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx35__13248B8F;

alter table er_bxzb drop column zyx35;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx36__1418AFC8;

alter table er_bxzb drop column zyx36;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx37__150CD401;

alter table er_bxzb drop column zyx37;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx38__1600F83A;

alter table er_bxzb drop column zyx38;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx39__16F51C73;

alter table er_bxzb drop column zyx39;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx40__17E940AC;

alter table er_bxzb drop column zyx40;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx41__18DD64E5;

alter table er_bxzb drop column zyx41;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx42__19D1891E;

alter table er_bxzb drop column zyx42;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx43__1AC5AD57;

alter table er_bxzb drop column zyx43;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx44__1BB9D190;

alter table er_bxzb drop column zyx44;

  alter table er_bxzb  drop constraint DF__er_bxzb__zyx45__1CADF5C9;

alter table er_bxzb drop column zyx45;

2、给元数据相关表插入新增的字段数据记录,主要有三张表需要插入相关记录:md_property、md_ormap、md_column

md_property:

--生成主键 select lower(NEWID());
--md_property表的 id 列的值跟 md_ormap表的 attributeid 列的值必须一样

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 1, null, null, 170, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'N', N'BS000010000100001032', 300, N'N', null, N'无发票类报销', null, N'N', null, N'N', null, N'N', N'ddf88bcc-776a-4445-9124-e464208e98a3', N'0', N'Y', null, null, null, N'no_invoice', N'N', N'N', 0, N'N', null, null, 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 1, null, null, 171, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'N', N'BS000010000100001032', 300, N'N', null, N'是否启用税务云', null, N'N', null, N'N', null, N'N', N'4abc4d05-a246-4979-967c-55de08fc03ef', N'0', N'Y', null, null, null, N'is_enabled_taxation_cloud', N'N', N'N', 0, N'N', null, null, 0, 0);

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 172, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项31', null, N'N', null, N'N', null, N'N', N'98f49bad-9b73-447a-8b42-93b0c7ded35c', N'0', N'Y', null, null, null, N'zyx31', N'N', N'Y', 0, N'N', null, '2UC000-000773', 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 173, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项32', null, N'N', null, N'N', null, N'N', N'1104d7ed-a341-4e50-a75b-b2bb56b9d788', N'0', N'Y', null, null, null, N'zyx32', N'N', N'Y', 0, N'N', null, '2UC000-000774', 0, 0);

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 174, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项33', null, N'N', null, N'N', null, N'N', N'535d0a5b-65ff-4b74-90e4-9ddd8e804992', N'0', N'Y', null, null, null, N'zyx33', N'N', N'Y', 0, N'N', null, '2UC000-000775', 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 175, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项34', null, N'N', null, N'N', null, N'N', N'478fa985-9a9e-43a3-ac2b-226e1f8d10c7', N'0', N'Y', null, null, null, N'zyx34', N'N', N'Y', 0, N'N', null, '2UC000-000776', 0, 0);

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 176, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项35', null, N'N', null, N'N', null, N'N', N'7de41ac9-788c-4b2c-9cce-fef84f51f0fa', N'0', N'Y', null, null, null, N'zyx35', N'N', N'Y', 0, N'N', null, '2UC000-000777', 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 177, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项36', null, N'N', null, N'N', null, N'N', N'fc3ad678-8ad8-41c8-b0ef-6fb67f4d3be2', N'0', N'Y', null, null, null, N'zyx36', N'N', N'Y', 0, N'N', null, '2UC000-000778', 0, 0);

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 178, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项37', null, N'N', null, N'N', null, N'N', N'a65f65ef-e106-4f38-b757-f390fd6443ef', N'0', N'Y', null, null, null, N'zyx37', N'N', N'Y', 0, N'N', null, '2UC000-000779', 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 179, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项38', null, N'N', null, N'N', null, N'N', N'a2742748-2396-47fd-80d9-20738989b14c', N'0', N'Y', null, null, null, N'zyx38', N'N', N'Y', 0, N'N', null, '2UC000-000780', 0, 0);

INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise, readonly, refmodelname, resid, versiontype, visibility) VALUES (null, N'N', null, 101, null, null, 180, N'N', N'd9b9f860-4dc7-47fa-a7d5-7a5d91f39290', N'0', null, null, N'Y', N'BS000010000100001056', 300, null, null, N'自定义项39', null, N'N', null, N'N', null, N'N', N'4ebd5c81-a77b-4046-9e0b-1753110f9338', N'0', N'Y', null, null, null, N'zyx39', N'N', N'Y', 0, N'N', null, '2UC000-000781', 0, 0);
INSERT INTO md_property (accessorclassname, accesspower, accesspowergroup, attrlength, attrmaxvalue, attrminvalue, attrsequence, calculation, classid, createindustry, createtime, creator, customattr, datatype, datatypestyle, defaultvalue, description, displayname, dr, dynamicattr, dynamictable, fixedlength, help, hided, id, industry, isactive, isauthen, modifier, modifytime, name, notserialize, nullable, precise,
  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值