Вы находитесь на странице: 1из 4

/* Created Modified Project Model Company Author Version Database */

4/10/2012 4/10/2012

MS SQL 2005

Create table [tb_cif] ( [cif_no] Char(13) NOT NULL, [type_no] Integer NOT NULL, Primary Key ([cif_no]) ) go Create table [tb_cif_in] ( [cif_in_no] Char(13) NOT NULL, [idno] Char(9) NULL, [iddt] Datetime NULL, [idis] Nvarchar(50) NULL, [sadd] Nvarchar(70) NULL, [tadd] Nvarchar(70) NULL, [oadd] Nvarchar(70) NULL, [htel] Varchar(15) NULL, [mtel] Varchar(15) NULL, [otel] Varchar(15) NULL, [fax] Varchar(15) NULL, [sex] Bit NULL, [vnm] Nvarchar(50) NULL, [enm] Nvarchar(50) NULL, Primary Key ([cif_in_no]) ) go Create table [tb_cif_type] ( [type_no] Integer NOT NULL, [typenm] Char(1) NULL, Primary Key ([type_no]) ) go Create table [tb_bksd] ( [bksd_no] Char(13) NOT NULL, [sex] Bit NULL, [nm] Nvarchar(50) NULL, [pos] Nvarchar(30) NULL, [idno] Char(9) NULL, [iddt] Datetime NULL, [idis] Nvarchar(70) NULL, [auno] Nvarchar(20) NULL, [audt] Datetime NULL, [auby] Nvarchar(70) NULL,

[otel] Char(15) NULL, [mtel] Char(15) NULL, [brch] Char(4) NULL, Primary Key ([bksd_no]) ) go Create table [tb_loan] ( [ln_no] Char(1) NOT NULL, [ln_crtyp_no] Integer NOT NULL, [loan_type_no] Integer NOT NULL, [acnt] Nvarchar(20) NULL, [tofnd] Money NULL, [lnamt] Money NULL, [lndt] Datetime NULL, [maty] Datetime NULL, [rpnm] Integer NULL, [inttype] Integer NULL, [inspd] Integer NULL, Primary Key ([ln_no]) ) go Create table [tb_loan_type] ( [loan_type_no] Integer NOT NULL, [ln_type] Nvarchar(50) NULL, Primary Key ([loan_type_no]) ) go Create table [tb_ln_crtyp] ( [ln_crtyp_no] Integer NOT NULL, [cr_type] Nvarchar(40) NULL, Primary Key ([ln_crtyp_no]) ) go Create table [tb_deposit] ( [deposit_no] Nchar(15) NOT NULL, [opdt] Datetime NULL, [opbk] Char(4) NULL, [damt] Money NULL, [maty] Datetime NULL, [dint] Float NULL, Primary Key ([deposit_no]) ) go Create table [tb_estate] ( [estate_no] Nvarchar(20) NOT NULL, [area] Numeric(18,2) NULL, [lv_area] Numeric(18,2) NULL, Primary Key ([estate_no]) ) go

Create table [tb_contact] ( [contact_no] Char(16) NOT NULL, [bksd_no] Char(13) NOT NULL, [cif_no] Char(13) NOT NULL, [dt] Datetime NULL, [ln_no] Char(1) NOT NULL, Primary Key ([contact_no],[ln_no]) ) go Create table [tb_cif_bu] ( [cif_bu_no] Char(1) NOT NULL, [vnm] Char(1) NULL, [enm] Char(1) NULL, [add] Char(1) NULL, [tel] Char(1) NULL, [fax] Char(1) NULL, [es_no] Char(1) NULL, [es_dt] Char(1) NULL, [es_is] Char(1) NULL, [tax_no] Char(1) NULL, Primary Key ([cif_bu_no]) ) go Alter table [tb_contact] add foreign key([cif_no]) references [tb_cif] ([cif_no ]) on update no action on delete no action go Alter table [tb_cif] add foreign key([type_no]) references [tb_cif_type] ([type _no]) on update no action on delete no action go Alter table [tb_contact] add foreign key([bksd_no]) references [tb_bksd] ([bksd _no]) on update no action on delete no action go Alter table [tb_contact] add foreign key([ln_no]) references [tb_loan] ([ln_no] ) on update no action on delete no action go Alter table [tb_loan] add foreign key([loan_type_no]) references [tb_loan_type] ([loan_type_no]) on update no action on delete no action go Alter table [tb_loan] add foreign key([ln_crtyp_no]) references [tb_ln_crtyp] ( [ln_crtyp_no]) on update no action on delete no action go Set quoted_identifier on go Set quoted_identifier off go /* Roles permissions */

/* Users permissions */

Вам также может понравиться