博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
GZFramwork数据库层《前言》Demo简介
阅读量:6679 次
发布时间:2019-06-25

本文共 25007 字,大约阅读时间需要 83 分钟。

本系列旨在熟悉GZFramwork数据库层操作,对数据库表进行增删改查,单据编号生成等:

详细见图:

普通单表操作:

 

 

 

 

 

数据库建模:

 

创建表脚本:

if exists (select 1   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')   where r.fkeyid = object_id('tb_CustomerDetail') and o.name = 'FK_TB_CUSTO_REFERENCE_TB_CUSTO')alter table tb_CustomerDetail   drop constraint FK_TB_CUSTO_REFERENCE_TB_CUSTOgoif exists (select 1   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')   where r.fkeyid = object_id('tb_DictionaryDetail') and o.name = 'FK_TB_DICTI_REFERENCE_TB_DICTI')alter table tb_DictionaryDetail   drop constraint FK_TB_DICTI_REFERENCE_TB_DICTIgoif exists (select 1   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')   where r.fkeyid = object_id('tb_EmployeeCon') and o.name = 'FK_TB_EMPLO_REFERENCE_TB_EMPLO')alter table tb_EmployeeCon   drop constraint FK_TB_EMPLO_REFERENCE_TB_EMPLOgoif exists (select 1            from  sysobjects           where  id = object_id('_tmp')            and   type = 'U')   drop table _tmpgoif exists (select 1            from  sysobjects           where  id = object_id('tb_Customer')            and   type = 'U')   drop table tb_Customergoif exists (select 1            from  sysobjects           where  id = object_id('tb_CustomerDetail')            and   type = 'U')   drop table tb_CustomerDetailgoif exists (select 1            from  sysobjects           where  id = object_id('tb_Dictionary')            and   type = 'U')   drop table tb_Dictionarygoif exists (select 1            from  sysobjects           where  id = object_id('tb_DictionaryDetail')            and   type = 'U')   drop table tb_DictionaryDetailgoif exists (select 1            from  sysobjects           where  id = object_id('tb_EmpLeave')            and   type = 'U')   drop table tb_EmpLeavegoif exists (select 1            from  sysobjects           where  id = object_id('tb_Employee')            and   type = 'U')   drop table tb_Employeegoif exists (select 1            from  sysobjects           where  id = object_id('tb_EmployeeCon')            and   type = 'U')   drop table tb_EmployeeCongoif exists (select 1            from  sysobjects           where  id = object_id('tb_MyUser')            and   type = 'U')   drop table tb_MyUsergo/*==============================================================*//* Table: _tmp                                                  *//*==============================================================*/create table _tmp (   isid                 int                  identity(1,1) not for replication,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null)godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '表公共字段',   'user', @CurrentUser, 'table', '_tmp'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', '_tmp', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', '_tmp', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', '_tmp', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', '_tmp', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', '_tmp', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_Customer                                           *//*==============================================================*/create table tb_Customer (   isid                 int                  identity(1,1) not for replication,   CustomerCode         varchar(20)          not null,   CustomerName         varchar(50)          null,   Adress               nvarchar(100)        null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_CUSTOMER primary key (CustomerCode))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '客户',   'user', @CurrentUser, 'table', 'tb_Customer'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '客户编号',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CustomerCode'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '客户名称',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CustomerName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '地址',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'Adress'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_CustomerDetail                                     *//*==============================================================*/create table tb_CustomerDetail (   isid                 int                  identity(1,1) not for replication,   CustomerCode         varchar(20)          null,   CustomerAttribute    varchar(50)          null,   CustomerATValue      nvarchar(100)        null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_CUSTOMERDETAIL primary key (isid))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '客户明细',   'user', @CurrentUser, 'table', 'tb_CustomerDetail'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '客户编号',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerCode'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '属性',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerAttribute'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '属性值',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerATValue'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_Dictionary                                         *//*==============================================================*/create table tb_Dictionary (   TypeID               varchar(10)          not null,   TypeName             varchar(20)          null,   Remark               varchar(200)         null,   isid                 int                  identity(1,1) not for replication,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_DICTIONARY primary key (TypeID))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '数据字典主表',   'user', @CurrentUser, 'table', 'tb_Dictionary'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '类别编号',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'TypeID'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '类别名称',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'TypeName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '备注',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'Remark'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_DictionaryDetail                                   *//*==============================================================*/create table tb_DictionaryDetail (   isid                 int                  identity(1,1) not for replication,   TypeID               varchar(10)          null,   DataCode             varchar(10)          null,   DataName             varchar(20)          null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_DICTIONARYDETAIL primary key (isid))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '数据字典明细',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '类别编号',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'TypeID'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '编号',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'DataCode'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '字典名称',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'DataName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_EmpLeave                                           *//*==============================================================*/create table tb_EmpLeave (   isid                 int                  identity(1,1) not for replication,   DocNo                varchar(20)          not null,   EmpName              varchar(20)          null,   BeginDate            datetime             null,   EndDate              datetime             null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_EMPLEAVE primary key (DocNo))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '请假记录',   'user', @CurrentUser, 'table', 'tb_EmpLeave'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '请假单号',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'DocNo'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '请假人',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'EmpName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '请假开始日期',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'BeginDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '请假结束日期',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'EndDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_Employee                                           *//*==============================================================*/create table tb_Employee (   isid                 int                  identity(1,1) not for replication,   InfoID               varchar(10)          not null,   EmpName              varchar(20)          null,   Sex                  varchar(2)           null,   Age                  int                  null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_EMPLOYEE primary key (InfoID))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '员工表',   'user', @CurrentUser, 'table', 'tb_Employee'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '员工编号',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'InfoID'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '姓名',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'EmpName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '性别',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'Sex'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '年龄',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'Age'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_EmployeeCon                                        *//*==============================================================*/create table tb_EmployeeCon (   isid                 int                  identity(1,1) not for replication,   InfoID               varchar(10)          null,   ConNo                varchar(10)          not null,   BeginDate            datetime             null,   EndDate              datetime             null,   Salary               int                  null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_EMPLOYEECON primary key nonclustered (ConNo))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '员工合同表',   'user', @CurrentUser, 'table', 'tb_EmployeeCon'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '员工编号',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'InfoID'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '合同编号',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'ConNo'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '合同开始日期',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'BeginDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '合同结束日期',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'EndDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '最低工资',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'Salary'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'LastUpdateDate'go/*==============================================================*//* Table: tb_MyUser                                             *//*==============================================================*/create table tb_MyUser (   isid                 int                  identity(1,1) not for replication,   Account              varchar(20)          not null,   UserName             varchar(20)          null,   PetName              varchar(20)          null,   CreateUser           varchar(20)          null,   CreateDate           datetime             null,   LastUpdateUser       varchar(20)          null,   LastUpdateDate       datetime             null,   constraint PK_TB_MYUSER primary key (Account))godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '用户表',   'user', @CurrentUser, 'table', 'tb_MyUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '自增列',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'isid'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '用户账号',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'Account'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '用户名称',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'UserName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '昵称',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'PetName'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建人',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'CreateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '创建日期',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'CreateDate'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改人',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'LastUpdateUser'godeclare @CurrentUser sysnameselect @CurrentUser = user_name()execute sp_addextendedproperty 'MS_Description',    '修改日期',   'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'LastUpdateDate'goalter table tb_CustomerDetail   add constraint FK_TB_CUSTO_REFERENCE_TB_CUSTO foreign key (CustomerCode)      references tb_Customer (CustomerCode)goalter table tb_DictionaryDetail   add constraint FK_TB_DICTI_REFERENCE_TB_DICTI foreign key (TypeID)      references tb_Dictionary (TypeID)goalter table tb_EmployeeCon   add constraint FK_TB_EMPLO_REFERENCE_TB_EMPLO foreign key (InfoID)      references tb_Employee (InfoID)go

 

本系列项目源码下载地址:https://github.com/GarsonZhang/GZFramework.Demo

 

系列文章

1.

2.

3.

4.

5.

6.

7. GZFramwork数据库层《五》高级主从表增删改查(主表明细表主键都自动生成)

8. GZFramwork数据库层《六》存储过程调用

9. GZFramwork数据库层《七》总结

 

转载于:https://www.cnblogs.com/GarsonZhang/p/4354002.html

你可能感兴趣的文章
Webpack 代码分离
查看>>
ssh下:系统初始化实现ServletContextListener接口时,获取spring中数据层对象无效的问题...
查看>>
extundelete
查看>>
powerviot install in sharepoint 2013
查看>>
javascript在我的工作的用法
查看>>
《告诉他们,我已乘白鹤去了》观后感——用生命换取信仰
查看>>
诡秘的“端口安全”功能
查看>>
为VMware ESXi主机添加本地存储的过程及注意事项-之4
查看>>
oracle 11g 客户端安装检查过程中报物理内存不足的解决
查看>>
nagios中自己写的监控mysql主从复制的插件
查看>>
SFB 项目经验-45-用培训课件当运维文档,聪明
查看>>
拿到了2013年10月微软MVP奖杯
查看>>
Windows Server 2012正式版RDS系列⑦
查看>>
字段校验器配置风格
查看>>
Office 2013新特性
查看>>
我的友情链接
查看>>
《OSSIM开发者手册》稿件即将完成。
查看>>
数据仓库入门(实验9)查询多维数据集
查看>>
oracle常用网址
查看>>
光棍节程序员闯关秀过关攻略
查看>>