Скрипты БД

Скрипт для создания таблицы в БД Oracle

CREATE TABLE ELN (
ID_ELN NUMBER(8) not null,
LN_CODE VARCHAR2(20) not null,
SNILS VARCHAR2(20) not null,
SURNAME VARCHAR2(100),
NAME1 VARCHAR2(100),
PATRONIMIC VARCHAR2(100),
PREV_LN_CODE VARCHAR2(20),
PRIMARY_FLAG NUMBER(1),
DUPLICATE_FLAG NUMBER(1),
LN_DATE DATE,
LPU_NAME VARCHAR2(500),
LPU_ADDRESS VARCHAR2(500),
REASON1 VARCHAR2(20),
RETURN_DATE_LPU DATE,
LN_STATE VARCHAR2(20),
LN_HASH VARCHAR2(100),
DATE_CREATED DATE default (SYSDATE),
DATE_MODIFYED DATE default (SYSDATE),
CREATED_BY VARCHAR2(50),
MODIFIED_BY VARCHAR2(50),
INN_PERSON VARCHAR2(20),
EMPLOYER VARCHAR2(100),
EMPL_FLAG NUMBER(1),
EMPL_REG_NO VARCHAR2(15),
EMPL_PARENT_NO VARCHAR2(10),
EMPL_REG_NO2 VARCHAR2(15),
APPROVE1 VARCHAR2(100),
APPROVE2 VARCHAR2(100),
BASE_AVG_SAL NUMBER(14,2),
BASE_AVG_DAILY_SAL NUMBER(14,2),
INSUR_YY NUMBER(2),
INSUR_MM NUMBER(2),
NOT_INSUR_YY NUMBER(2),
NOT_INSUR_MM NUMBER(2),
CALC_CONDITION1 VARCHAR2(2),
CALC_CONDITION2 VARCHAR2(2),
CALC_CONDITION3 VARCHAR2(2),
CALC_CONDITION4 VARCHAR2(2),
FORM1_DT DATE,
RETURN_DATE_EMPL DATE,
DT1_LN DATE,
DT2_LN DATE,
EMPL_PAYMENT NUMBER(14,2),
FSS_PAYMENT NUMBER(14,2),
PAYMENT NUMBER(14,2),
BOZ_FLAG NUMBER(1),
LPU_OGRN VARCHAR2(20),
REASON2 VARCHAR2(20),
REASON3 VARCHAR2(20),
DATE1 DATE,
DATE2 DATE,
VOUCHER_NO VARCHAR2(20),
VOUCHER_OGRN VARCHAR2(20),
SERV1_AGE NUMBER(3),
SERV1_MM NUMBER(2),
SERV1_RELATION_CODE VARCHAR2(20),
SERV1_FIO VARCHAR2(100),
SERV2_AGE NUMBER(3),
SERV2_MM NUMBER(2),
SERV2_RELATION_CODE VARCHAR2(20),
SERV2_FIO VARCHAR2(100),
PREGN12W_FLAG NUMBER(1),
HOSPITAL_BREACH_CODE VARCHAR2(20),
HOSPITAL_BREACH_DT DATE,
MSE_DT1 DATE,
MSE_DT2 DATE,
MSE_DT3 DATE,
MSE_INVALID_GROUP NUMBER(1),
MSE_RESULT VARCHAR2(20),
OTHER_STATE_DT DATE,
NEXT_LN_CODE VARCHAR2(20),
TREAT1_DT1 DATE,
TREAT1_DT2 DATE,
TREAT1_DOCTOR_ROLE VARCHAR2(300),
TREAT1_DOCTOR VARCHAR2(100),
TREAT2_DT1 DATE,
TREAT2_DT2 DATE,
TREAT2_DOCTOR_ROLE VARCHAR2(300),
TREAT2_DOCTOR VARCHAR2(100),
TREAT3_DT1 DATE,
TREAT3_DT2 DATE,
TREAT3_DOCTOR_ROLE VARCHAR2(300),
TREAT3_DOCTOR VARCHAR2(100),
STATUS NUMBER(1),
MESS VARCHAR2(500),
HOSPITAL_DT1 DATE,
HOSPITAL_DT2 DATE,
CORRECTION_REASON VARCHAR2(10),
CORRECTION_NOTE VARCHAR2(4000)
)
tablespace BYX
pctfree 10
initrans 1
maxtrans 255
storage (
initial 64K
next 1M
minextents 1
maxextents unlimited);
alter table ELN
add primary key (ID_ELN)
using index
tablespace BYX
pctfree 10
initrans 2
maxtrans 255
storage (
initial 64K
next 1M
minextents 1
maxextents unlimited);

 

Скачать скрипт

Вернуться на главную страницу

Скрипт для создания таблицы в БД MSSQL

CREATE TABLE ELN(
[ID_ELN] [int] IDENTITY(1,1) NOT NULL,
[LN_CODE] [nvarchar](20) NOT NULL,
[SNILS] [nvarchar](20) NOT NULL,
[SURNAME] [nvarchar](100) NULL,
[NAME1] [nvarchar](100) NULL,
[PATRONIMIC] [nvarchar](100) NULL,
[PREV_LN_CODE] [nvarchar](20) NULL,
[PRIMARY_FLAG] [int] NULL,
[DUPLICATE_FLAG] [int] NULL,
[LN_DATE] [date] NULL,
[LPU_NAME] [nvarchar](500) NULL,
[LPU_ADDRESS] [nvarchar](500) NULL,
[REASON1] [nvarchar](20) NULL,
[RETURN_DATE_LPU] [date] NULL,
[LN_STATE] [nvarchar](20) NULL,
[LN_HASH] [nvarchar](100) NULL,
[DATE_CREATED] [date] NULL,
[DATE_MODIFYED] [date] NULL,
[CREATED_BY] [nvarchar](50) NULL,
[MODIFIED_BY] [nvarchar](50) NULL,
[INN_PERSON] [nvarchar](20) NULL,
[EMPLOYER] [nvarchar](100) NULL,
[EMPL_FLAG] [int] NULL,
[EMPL_REG_NO] [nvarchar](15) NULL,
[EMPL_PARENT_NO] [nvarchar](10) NULL,
[EMPL_REG_NO2] [nvarchar](15) NULL,
[APPROVE1] [nvarchar](100) NULL,
[APPROVE2] [nvarchar](100) NULL,
[BASE_AVG_SAL] [numeric](14, 2) NULL,
[BASE_AVG_DAILY_SAL] [numeric](14, 2) NULL,
[INSUR_YY] [numeric](2, 0) NULL,
[INSUR_MM] [numeric](2, 0) NULL,
[NOT_INSUR_YY] [numeric](2, 0) NULL,
[NOT_INSUR_MM] [numeric](2, 0) NULL,
[CALC_CONDITION1] [nvarchar](2) NULL,
[CALC_CONDITION2] [nvarchar](2) NULL,
[CALC_CONDITION3] [nvarchar](2) NULL,
[CALC_CONDITION4] [nvarchar](2) NULL,
[FORM1_DT] [date] NULL,
[RETURN_DATE_EMPL] [date] NULL,
[DT1_LN] [date] NULL,
[DT2_LN] [date] NULL,
[EMPL_PAYMENT] [numeric](14, 2) NULL,
[FSS_PAYMENT] [numeric](14, 2) NULL,
[PAYMENT] [numeric](14, 2) NULL,
[BOZ_FLAG] [numeric](1, 0) NULL,
[LPU_OGRN] [nvarchar](20) NULL,
[REASON2] [nvarchar](20) NULL,
[REASON3] [nvarchar](20) NULL,
[DATE1] [date] NULL,
[DATE2] [date] NULL,
[VOUCHER_NO] [nvarchar](20) NULL,
[VOUCHER_OGRN] [nvarchar](20) NULL,
[SERV1_AGE] [numeric](3, 0) NULL,
[SERV1_MM] [numeric](2, 0) NULL,
[SERV1_RELATION_CODE] [nvarchar](20) NULL,
[SERV1_FIO] [nvarchar](100) NULL,
[SERV2_AGE] [numeric](3, 0) NULL,
[SERV2_MM] [numeric](2, 0) NULL,
[SERV2_RELATION_CODE] [nvarchar](20) NULL,
[SERV2_FIO] [nvarchar](100) NULL,
[PREGN12W_FLAG] [int] NULL,
[HOSPITAL_BREACH_CODE] [nvarchar](20) NULL,
[HOSPITAL_BREACH_DT] [date] NULL,
[MSE_DT1] [date] NULL,
[MSE_DT2] [date] NULL,
[MSE_DT3] [date] NULL,
[MSE_INVALID_GROUP] [int] NULL,
[MSE_RESULT] [nvarchar](20) NULL,
[OTHER_STATE_DT] [date] NULL,
[NEXT_LN_CODE] [nvarchar](20) NULL,
[TREAT1_DT1] [date] NULL,
[TREAT1_DT2] [date] NULL,
[TREAT1_DOCTOR_ROLE] [nvarchar](300) NULL,
[TREAT1_DOCTOR] [nvarchar](100) NULL,
[TREAT2_DT1] [date] NULL,
[TREAT2_DT2] [date] NULL,
[TREAT2_DOCTOR_ROLE] [nvarchar](300) NULL,
[TREAT2_DOCTOR] [nvarchar](100) NULL,
[TREAT3_DT1] [date] NULL,
[TREAT3_DT2] [date] NULL,
[TREAT3_DOCTOR_ROLE] [nvarchar](300) NULL,
[TREAT3_DOCTOR] [nvarchar](100) NULL,
[STATUS] [int] NULL,
[MESS] [nvarchar](500) NULL,
[HOSPITAL_DT1] [date] NULL,
[HOSPITAL_DT2] [date] NULL,
[CORRECTION_REASON] [nvarchar](10) NULL,
[CORRECTION_NOTE] [nvarchar](4000) NULL,
CONSTRAINT [PK_ELN] PRIMARY KEY CLUSTERED
(
[ID_ELN] ASC
)WITH (PAD_INDEX = OFF,
STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
) ON [PRIMARY]

 

Скачать скрипт

Вернуться на главную страницу