crebas.sql

来自「地址档案管理系统」· SQL 代码 · 共 60 行

SQL
60
字号
/*==============================================================*/
/* Database name:  PhysicalDataModel_1                          */
/* DBMS name:      Microsoft SQL Server 2000                    */
/* Created on:     2004-8-17 18:23:10                           */
/*==============================================================*/


alter table detail_code
   drop constraint FK_DETAIL_C_REFERENCE_MASTER_C
go


if exists (select 1
            from  sysobjects
           where  id = object_id('detail_code')
            and   type = 'U')
   drop table detail_code
go


if exists (select 1
            from  sysobjects
           where  id = object_id('master_code')
            and   type = 'U')
   drop table master_code
go


/*==============================================================*/
/* Table: detail_code                                           */
/*==============================================================*/
create table detail_code (
   master_code          nvarchar(20)         not null,
   detail_code          nvarchar(50)         not null,
   caption              nvarchar(50)         not null,
   note                 nvarchar(50)         null,
   constraint PK_DETAIL_CODE primary key  (master_code, detail_code)
)
go


/*==============================================================*/
/* Table: master_code                                           */
/*==============================================================*/
create table master_code (
   code                 nvarchar(20)         not null,
   caption              nvarchar(50)         not null,
   note                 nvarchar(50)         null,
   constraint PK_MASTER_CODE primary key  (code)
)
go


alter table detail_code
   add constraint FK_DETAIL_C_REFERENCE_MASTER_C foreign key (master_code)
      references master_code (code)
go


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?