· 5 years ago · Jun 16, 2020, 01:16 PM
1--------------------------------------------------------------------------------------------
2--- TABLE DEFINITION
3--- T_DniWolne - Tabela zawiera dni wolne od pracy
4--- CREATED BY: GK
5--- drop table T_DniWolne
6--------------------------------------------------------------------------------------------
7
8IF db_name()<>'master' and
9 not exists ( select * from INFORMATION_SCHEMA.TABLES
10 where table_name='T_DniWolne' and table_type='BASE TABLE')
11BEGIN
12 Print 'Creating table T_DniWolne';
13
14 CREATE TABLE [dbo].T_DniWolne(
15 Id BIGINT IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, -- Primary Key
16 -- Status-like fields
17 flgDeleted tinyint not null default 0, -- określa czy pole jest usunięte (1) czy nie (0)
18 FirmID bigint not null default 0, -- id firmy
19 -- Fields that will be joined with other tables
20
21 -- Fields to be edited
22 [NazwaOkazji] nvarchar(255) not null default '', -- nazwa okazji z jakiej dzień jest wolny
23 [Data] date not null default '1900-01-01' UNIQUE, -- data dnia wolnego
24 [flgTypDniaWolnego] tinyint not null default 0, -- typ dnia wolnego (0 - dzień ustawowo wolny)
25
26 -- Other fiels
27 ROWGUID uniqueidentifier not null default NEWID(),
28
29 -- Fields to be calculated only by triggers
30 -- This kind of fields must begin with '_'
31
32 cDataMod datetime not null default '1900-01-01', -- data modyfikacji
33 cDataUtw datetime not null default '1900-01-01', -- data utworzenia
34 cUserMod bigint not null default 0, -- kto modyfiokował
35 cUserUtw bigint not null default 0, -- kto utworzyl
36
37
38 -- This line should be removed if the table does not have primary key
39 CONSTRAINT IdxNoclust_T_DniWolne_Id PRIMARY KEY (Id)
40 );
41
42END;