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.ProcedureSubspecialtyTypes
(
--source:
--A06/SQL52, SPV.Dim.ProcedureSubspecialtyType
--fields
ProcedureSubspecialtyTypeID int IDENTITY(1,1) NOT NULL, --EPRS assigned (PK)
StationID smallint NOT NULL, --EPRS assigned (FK), references Stations, break out sta6a choices
ProcedureSubspecialtyTypeName varchar(50) null,
--primary key
CONSTRAINT PK_ProcedureSubspecialtyTypes PRIMARY KEY CLUSTERED
(
ProcedureSubspecialtyTypeID ASC
)
)
ON DefinitionData
--when using clustered columnstore index, can't set data compression to PAGE
--using data compression, we have more than 10k recs but way less than 1 million recs
WITH (DATA_COMPRESSION = PAGE)
GO
/**
[ProcedureSubspecialtyTypeSID]
,[ProcedureSubspecialtyTypeIEN]
,[Sta3n]
,[ProcedureSubspecialtyType]
,[VistAGlobalLocation]
,[MedicalPatientFieldNumber]
,[ScreenOneName]
,[BriefScreenOneName]
,[Subspecialty]
,[EntryPointOfPrintRoutine]
,[PrintRoutine]
,[PrintLine]
,[FullProcedurePrintName]
,[GenericModuleFlag]
,[InputTemplate]
,[BriefInputTemplate]
,[MCESFlag]
,[MCESKey]
,[ViewingOfSupersededRecordFlag]
,[ReleaseNotVerifiedStatusFlag]
,[ViewAllFlag]
,[LocallyDefinedNameFlag]
,[EntryType]
,[ETLBatchID]
,[OpCode]
,[VistaCreateDate]
,[VistaEditDate]
**/
--foreign keys
ALTER TABLE dbo.ProcedureSubspecialtyTypes
ADD CONSTRAINT FK_ProcedureSubspecialtyTypes_Stations
FOREIGN KEY (StationID)
REFERENCES dbo.Stations (StationID)
GO
--indexes
CREATE NONCLUSTERED INDEX IX_ProcedureSubspecialtyTypes_StationID ON dbo.StopCodes
(
StationID
) 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 DefinitionIndex
GO
--constraints
--Metadata descriptions for each field
EXECUTE sp_addextendedproperty
N'MS_Description', N'Primary Key, unique to EPRS, source: Dim.ProcedureSubspecialtyType',
N'SCHEMA', N'dbo',
N'TABLE', N'ProcedureSubspecialtyTypes',
N'COLUMN', N'ProcedureSubspecialtyTypeID'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'Foreign Key, unique to EPRS, relates to Stations table; source: sta3n or derived sta6a',
N'SCHEMA', N'dbo',
N'TABLE', N'ProcedureSubspecialtyTypes',
N'COLUMN', N'StationID'
GO
EXECUTE sp_addextendedproperty
N'MS_Description', N'Relates to dim.ProcedureSubspecialtyType',
N'SCHEMA', N'dbo',
N'TABLE', N'ProcedureSubspecialtyTypes',
N'COLUMN', N'ProcedureSubspecialtyTypeName'
GO
--EXECUTE sp_addextendedproperty
--N'MS_Description', N'Relates to dim.ProcedureSubspecialtyType',
--N'SCHEMA', N'dbo',
--N'TABLE', N'ProcedureSubspecialtyTypes',
--N'COLUMN', N'Subspecialtyname'
--GO