Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
?CREATE TABLE dbo.SyncLogs
(
--fields
SyncLogID bigint IDENTITY(1,1) NOT NULL,
BatchLogID BIGINT,
TableName varchar (50),
DateSynchronized datetime2(7),
SyncRecordCount int,
--primary key
CONSTRAINT PK_SyncLogs PRIMARY KEY CLUSTERED
(
SyncLogID ASC
)
)
ON AuditData
--when using clustered columnstore index, can't set data compression to PAGE
WITH (DATA_COMPRESSION = PAGE)
GO
--foreign keys
ALTER TABLE dbo.SyncLogs
ADD CONSTRAINT FK_SyncLogs_BatchLogs
FOREIGN KEY (BatchLogID)
REFERENCES BatchLogs (BatchLogID)
GO
--indexes
CREATE NONCLUSTERED INDEX IX_SyncLogs_TableName ON dbo.SyncLogs
(
TableName
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 90, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO
CREATE NONCLUSTERED INDEX IX_SyncLogs_DateSynchronized ON dbo.SyncLogs
(
DateSynchronized
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 90, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO
--constraints
--Metadata descriptions for each field
EXECUTE sp_addextendedproperty
N'MS_Description', N'Prinary Key, unique to EPRS',
N'SCHEMA', N'dbo',
N'TABLE', N'SyncLogs',
N'COLUMN', N'SyncLogID'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'identified the date for each batch loaded',
N'SCHEMA', N'dbo',
N'TABLE', N'SyncLogs',
N'COLUMN', N'BatchLogID'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'Name of the table loaded',
N'SCHEMA', N'dbo',
N'TABLE', N'SyncLogs',
N'COLUMN', N'TableName'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'Date of the Synchronization',
N'SCHEMA', N'dbo',
N'TABLE', N'SyncLogs',
N'COLUMN', N'DateSynchronized'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'Number of records loaded/touched by the sync process',
N'SCHEMA', N'dbo',
N'TABLE', N'SyncLogs',
N'COLUMN', N'SyncRecordCount'
GO