SourceCode/PROMS/SQL Data Tools/RO Memory/script_DeployRofstData (2022.04.12).sql
2023-05-09 18:21:47 +00:00

961 lines
30 KiB
Transact-SQL

/****** Object: StoredProcedure [dbo].[vesp_RofstHeaderInsert] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstHeaderInsert]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetRofstByID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetRofstByID]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetDatabases] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetDatabases]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetDatabaseByID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetDatabaseByID]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildrenByRoid] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetChildrenByRoid]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildrenByRofstID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetChildrenByRofstID]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByRoid] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetChildByRoid]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetChildByID]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByAccPageID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataGetChildByAccPageID]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataExists] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDataExists]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDatabaseInsert] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstDatabaseInsert]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstChildInsert] Script Date: 4/8/2022 9:34:03 AM ******/
DROP PROCEDURE IF EXISTS [dbo].[vesp_RofstChildInsert]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstHeader]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstHeader] DROP CONSTRAINT IF EXISTS [FK_RofstHeader_ROFsts]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstDatabase]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstDatabase] DROP CONSTRAINT IF EXISTS [FK_RofstDatabase_RofstHeader]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstChild]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstChild] DROP CONSTRAINT IF EXISTS [FK_RofstChild_RofstDatabase]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstHeader]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstHeader] DROP CONSTRAINT IF EXISTS [DF_RofstHeader_CreateDate]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstHeader]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstHeader] DROP CONSTRAINT IF EXISTS [DF_RofstHeader_CreateUserID]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RofstDatabase]') AND type in (N'U'))
ALTER TABLE [dbo].[RofstDatabase] DROP CONSTRAINT IF EXISTS [DF_RofstDatabase_ParentID]
GO
/****** Object: Index [IX_RofstID_Roid] Script Date: 4/8/2022 9:34:03 AM ******/
DROP INDEX IF EXISTS [IX_RofstID_Roid] ON [dbo].[RofstChild]
GO
/****** Object: Index [IX_RofstID_DbiID_ParentID] Script Date: 4/8/2022 9:34:03 AM ******/
DROP INDEX IF EXISTS [IX_RofstID_DbiID_ParentID] ON [dbo].[RofstChild]
GO
/****** Object: View [dbo].[vwRofstData_RofstDatabases] Script Date: 4/8/2022 9:34:03 AM ******/
DROP VIEW IF EXISTS [dbo].[vwRofstData_RofstDatabases]
GO
/****** Object: View [dbo].[vwRofstData_RofstGroups] Script Date: 4/8/2022 9:34:03 AM ******/
DROP VIEW IF EXISTS [dbo].[vwRofstData_RofstGroups]
GO
/****** Object: View [dbo].[vwRofstData_RofstHeaders] Script Date: 4/8/2022 9:34:03 AM ******/
DROP VIEW IF EXISTS [dbo].[vwRofstData_RofstHeaders]
GO
/****** Object: Table [dbo].[RofstHeader] Script Date: 4/8/2022 9:34:03 AM ******/
DROP TABLE IF EXISTS [dbo].[RofstHeader]
GO
/****** Object: View [dbo].[vwRofstData_RofstChildren] Script Date: 4/8/2022 9:34:03 AM ******/
DROP VIEW IF EXISTS [dbo].[vwRofstData_RofstChildren]
GO
/****** Object: Table [dbo].[RofstDatabase] Script Date: 4/8/2022 9:34:03 AM ******/
DROP TABLE IF EXISTS [dbo].[RofstDatabase]
GO
/****** Object: Table [dbo].[RofstChild] Script Date: 4/8/2022 9:34:03 AM ******/
DROP TABLE IF EXISTS [dbo].[RofstChild]
GO
/****** Object: UserDefinedFunction [dbo].[vefn_ParseStringListToTable] Script Date: 4/8/2022 9:34:03 AM ******/
DROP FUNCTION IF EXISTS [dbo].[vefn_ParseStringListToTable]
GO
/****** Object: UserDefinedFunction [dbo].[vefn_NumOfOccurrences] Script Date: 4/8/2022 9:34:03 AM ******/
DROP FUNCTION IF EXISTS [dbo].[vefn_NumOfOccurrences]
GO
/****** Object: UserDefinedFunction [dbo].[vefn_NumOfOccurrences] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==========================================================================================
-- Author: Jake Ropar
-- Create Date: 3/1/2022
-- Description: Returns the number of occurences of a specific value in a specified string
-- ==========================================================================================
CREATE FUNCTION [dbo].[vefn_NumOfOccurrences](@Text VarChar(Max), @Value VarChar(Max)) Returns Int
WITH EXECUTE AS OWNER
AS
BEGIN
Declare @ValueCount Int;
If (Len(@Value) = 0)
Set @ValueCount = 0;
Else
Set @ValueCount = (Len(@Text) - Len(Replace(@Text, @Value, ''))) / Len(@Value);
Return @ValueCount;
END
GO
/****** Object: UserDefinedFunction [dbo].[vefn_ParseStringListToTable] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==========================================================================================
-- Author: Jake Ropar
-- Create Date: 3/26/2018
-- Description: Splits a delimited list of strings into a table of string values
-- ==========================================================================================
Create Function [dbo].[vefn_ParseStringListToTable] ( @List VarChar(Max), @Delimeter VarChar(1) = null )
Returns @RetVal Table (ListPosition Int Identity(1,1) Not Null, ListValue VarChar(Max) Not Null)
With Execute As Owner
As
Begin
Declare @Position Int;
Declare @TextPosition Int;
Declare @Length smallint;
Declare @String VarChar(Max);
Declare @TempString VarChar(Max);
Declare @LeftOver VarChar(Max);
Set @TextPosition = 1;
Set @LeftOver = '';
Set @Delimeter = IsNull(@Delimeter, ',');
If (DataLength(@List) = 1)
Insert @RetVal (ListValue) Values (Cast(@List as VarChar(Max)));
Else
Begin
While (@TextPosition <= DataLength(@List) / 2)
Begin
Set @Length = (4000 - DataLength(@LeftOver) / 2);
Set @TempString = LTrim(@LeftOver + Substring(@List, @TextPosition, @Length));
Set @TextPosition = @TextPosition + @Length;
Set @Position = CharIndex(@Delimeter, @TempString);
While (@Position > 0)
Begin
Set @String = Substring(@TempString, 1, @Position - 1);
Insert @RetVal (ListValue) Values (Cast(@String as VarChar(Max)));
Set @TempString = LTrim(Substring(@TempString, @Position + 1, Len(@TempString)));
Set @Position = CharIndex(@Delimeter, @TempString);
End
Set @LeftOver = @TempString;
End
End
If (LTrim(RTrim(@LeftOver)) <> '')
Insert @RetVal (ListValue) Values (Cast(@LeftOver as VarChar(Max)));
Return;
End
GO
/****** Object: Table [dbo].[RofstChild] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RofstChild](
[RofstChildID] [int] IDENTITY(1,1) NOT NULL,
[RofstID] [int] NOT NULL,
[dbiID] [int] NOT NULL,
[ID] [int] NOT NULL,
[ParentID] [int] NOT NULL,
[type] [int] NOT NULL,
[title] [varchar](max) NOT NULL,
[roid] [varchar](50) NOT NULL,
[appid] [varchar](max) NULL,
[value] [varchar](max) NULL,
CONSTRAINT [PK_RofstChild] PRIMARY KEY CLUSTERED
(
[RofstChildID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[RofstDatabase] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RofstDatabase](
[RofstID] [int] NOT NULL,
[dbiID] [int] NOT NULL,
[dbiType] [int] NOT NULL,
[dbiAW] [int] NOT NULL,
[dbiTitle] [varchar](max) NOT NULL,
[dbiAP] [varchar](max) NOT NULL,
[ID] [int] NOT NULL,
[ParentID] [int] NOT NULL,
CONSTRAINT [PK_RofstDatabase_1] PRIMARY KEY CLUSTERED
(
[RofstID] ASC,
[dbiID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: View [dbo].[vwRofstData_RofstChildren] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2024
Description: (RofstData) Master View for RofstChildren (RoChild & Groups)
==========================================================================================================
*/
Create View [dbo].[vwRofstData_RofstChildren]
As
Select rc.RofstChildID as 'RofstChildID',
rd.RofstID as 'RofstID',
rd.dbiID as 'dbiID',
rd.dbiType as 'dbiType',
rd.dbiAW as 'dbiAW',
rd.dbiTitle as 'dbiTitle',
rd.dbiAP as 'dbiAP',
rc.ID as 'ID',
rc.ParentID as 'ParentID',
rc.[type] as 'type',
rc.title as 'title',
rc.roid as 'roid',
rc.appid as 'appid',
rc.[value] as 'value',
Case When (Not rc.[value] is null) Then rd.dbiAP + '-' + rc.appid Else null End as 'AccPageID'
From RofstChild rc With (NoLock)
inner join RofstDatabase rd With (NoLock) on rc.RofstID = rd.RofstID and rc.dbiID = rd.dbiID;
GO
/****** Object: Table [dbo].[RofstHeader] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RofstHeader](
[RofstID] [int] NOT NULL,
[hSize] [int] NOT NULL,
[hMonth] [int] NOT NULL,
[hDay] [int] NOT NULL,
[hcYear] [int] NOT NULL,
[hcMonth] [int] NOT NULL,
[hcDay] [int] NOT NULL,
[hcHour] [int] NOT NULL,
[hcMin] [int] NOT NULL,
[hcSec] [int] NOT NULL,
[hcHund] [int] NOT NULL,
[CreateUserID] [varchar](50) NOT NULL,
[CreateDate] [datetime] NOT NULL,
CONSTRAINT [PK_RofstHeader] PRIMARY KEY CLUSTERED
(
[RofstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: View [dbo].[vwRofstData_RofstHeaders] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2024
Description: (RofstData) Master View for RofstHeaders
==========================================================================================================
*/
Create View [dbo].[vwRofstData_RofstHeaders]
As
Select rh.RofstID as 'RofstID',
rh.hSize as 'hSize',
rh.hMonth as 'hMonth',
rh.hDay as 'hDay',
rh.hcYear as 'hcYear',
rh.hcMonth as 'hcMonth',
rh.hcDay as 'hcDay',
rh.hcHour as 'hcHour',
rh.hcMin as 'hcMin',
rh.hcSec as 'hcSec',
rh.hcHund as 'hcHund',
rh.CreateUserID as 'CreateUserID',
rh.CreateDate as 'CreateDate'
From RofstHeader rh With (NoLock)
GO
/****** Object: View [dbo].[vwRofstData_RofstGroups] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2024
Description: (RofstData) Master View for RofstGroups
==========================================================================================================
*/
Create View [dbo].[vwRofstData_RofstGroups]
As
Select rd.RofstID as 'RofstID',
rd.dbiID as 'dbiID',
rd.dbiType as 'dbiType',
rd.dbiAW as 'dbiAW',
rd.dbiTitle as 'dbiTitle',
rd.dbiAP as 'dbiAP',
rc.ID as 'ID',
rc.ParentID as 'ParentID',
rc.type as 'type',
rc.title as 'title',
rc.roid as 'riod'
From RofstChild rc With (NoLock)
inner join RofstDatabase rd With (NoLock) on rc.RofstID = rd.RofstID and rc.dbiID = rd.dbiID
Where rc.value is null;
GO
/****** Object: View [dbo].[vwRofstData_RofstDatabases] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2024
Description: (RofstData) Master View for RofstDatabases
==========================================================================================================
*/
Create View [dbo].[vwRofstData_RofstDatabases]
As
Select rd.RofstID as 'RofstID',
rd.dbiID as 'dbiID',
rd.dbiType as 'dbiType',
rd.dbiAW as 'dbiAW',
rd.dbiTitle as 'dbiTitle',
rd.dbiAP as 'dbiAP',
rd.ID as 'ID',
rd.ParentID as 'ParentID'
From RofstDatabase rd With (NoLock)
GO
/****** Object: Index [IX_RofstID_DbiID_ParentID] Script Date: 4/8/2022 9:34:03 AM ******/
CREATE NONCLUSTERED INDEX [IX_RofstID_DbiID_ParentID] ON [dbo].[RofstChild]
(
[RofstID] ASC,
[dbiID] ASC,
[ParentID] ASC
)
INCLUDE([ID],[type],[title],[roid],[appid],[value]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_RofstID_Roid] Script Date: 4/8/2022 9:34:03 AM ******/
CREATE NONCLUSTERED INDEX [IX_RofstID_Roid] ON [dbo].[RofstChild]
(
[RofstID] ASC,
[roid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RofstDatabase] ADD CONSTRAINT [DF_RofstDatabase_ParentID] DEFAULT ((0)) FOR [ParentID]
GO
ALTER TABLE [dbo].[RofstHeader] ADD CONSTRAINT [DF_RofstHeader_CreateUserID] DEFAULT ('SYSTEM') FOR [CreateUserID]
GO
ALTER TABLE [dbo].[RofstHeader] ADD CONSTRAINT [DF_RofstHeader_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
GO
ALTER TABLE [dbo].[RofstChild] WITH CHECK ADD CONSTRAINT [FK_RofstChild_RofstDatabase] FOREIGN KEY([RofstID], [dbiID])
REFERENCES [dbo].[RofstDatabase] ([RofstID], [dbiID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[RofstChild] CHECK CONSTRAINT [FK_RofstChild_RofstDatabase]
GO
ALTER TABLE [dbo].[RofstDatabase] WITH CHECK ADD CONSTRAINT [FK_RofstDatabase_RofstHeader] FOREIGN KEY([RofstID])
REFERENCES [dbo].[RofstHeader] ([RofstID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[RofstDatabase] CHECK CONSTRAINT [FK_RofstDatabase_RofstHeader]
GO
ALTER TABLE [dbo].[RofstHeader] WITH CHECK ADD CONSTRAINT [FK_RofstHeader_ROFsts] FOREIGN KEY([RofstID])
REFERENCES [dbo].[ROFsts] ([ROFstID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[RofstHeader] CHECK CONSTRAINT [FK_RofstHeader_ROFsts]
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstChildInsert] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstChildInsert]
(
@RofstID Int,
@ID Int,
@ParentID Int,
@dbiID Int,
@type Int,
@title VarChar(Max),
@roid VarChar(50),
@appid VarChar(Max) = null,
@value VarChar(Max) = null
)
With Execute as Owner
As
Begin
-- Create Rofst Child/Group Record
Insert Into RofstChild (RofstID, ID, ParentID, dbiID, [type], title, roid, appid, [value])
Values (@RofstID, @ID, @ParentID, @dbiID, @type, @title, @roid, @appid, @value);
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDatabaseInsert] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDatabaseInsert]
(
@RofstID Int,
@dbiID Int,
@dbiType Int,
@dbiAW Int,
@dbiTitle VarChar(Max),
@dbiAP VarChar(Max),
@ID Int,
@ParentID Int
)
With Execute as Owner
As
Begin
Insert Into RofstDatabase ( RofstID, dbiID, dbiType, dbiAW, dbiTitle, dbiAP, ID, ParentID)
Values ( @RofstID, @dbiID, @dbiType, @dbiAW, @dbiTitle, @dbiAP, @ID, @ParentID);
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataExists] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataExists]
(
@RofstID int
)
With Execute as Owner
As
Begin
Select Count(1)
From RofstHeader with (NoLock)
Where RofstID = @RofstID;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByAccPageID] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildByAccPageID]
(
@RofstID int,
@AccPageID VarChar(50)
)
With Execute as Owner
As
Begin
Select rc.ROFstID,
rc.dbiID,
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From vwRofstData_RofstChildren rc
Where rc.RofstID = @RofstID
And rc.AccPageID = @AccPageID;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByID] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildByID]
(
@RofstID int,
@DbiID int,
@ID Int
)
With Execute as Owner
As
Begin
Select rc.RofstID,
rc.dbiID,
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From vwRofstData_RofstChildren rc
Where rc.RofstID = @RofstID
And rc.dbiID = @DbiID
And rc.ID = @ID;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildByRoid] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildByRoid]
(
@RofstID int,
@Roid VarChar(50)
)
With Execute as Owner
As
Begin
Select rc.ROFstID,
rc.dbiID,
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From vwRofstData_RofstChildren rc
Where rc.RofstID = @RofstID
And rc.roid = @Roid;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildrenByRofstID] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildrenByRofstID]
(
@RofstID int
)
With Execute as Owner
As
Begin
Select rc.RofstID,
rc.dbiID,
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From vwRofstData_RofstChildren rc
Where rc.RofstID = @RofstID
And Not rc.[value] is null
Order By rc.dbiID Asc, rc.[type] Asc, rc.roid Asc;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetChildrenByRoid] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetChildrenByRoid]
(
@RofstID int,
@Roid VarChar(50)
)
With Execute as Owner
As
Begin
With RoParent as
(
Select RofstID, dbiID, ID, [type], title, roid
From vwRofstData_RofstChildren
Where RofstID = @RofstID And roid = @Roid
)
Select rc.RofstID,
rc.dbiID,
-- Ro Parent Info
rp.[type] as 'ParentType',
rp.title as 'ParentTitle',
rp.roid as 'ParentRoid',
-- Ro Child Info
rc.ID,
rc.ParentID,
rc.[type],
rc.title,
rc.roid,
rc.appid,
rc.[value],
rc.AccPageID
From RoParent rp
inner join vwRofstData_RofstChildren rc on rc.RofstID = rp.RofstID and rc.dbiID = rp.dbiID and rc.ParentID = rp.ID
Order By rc.ID Asc;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetDatabaseByID] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetDatabaseByID]
(
@RofstID int,
@dbiID int
)
With Execute as Owner
As
Begin
Select rd.RofstID,
rd.dbiID,
rd.dbiType,
rd.dbiAW,
rd.dbiTitle,
rd.dbiAP,
rd.ID,
rd.ParentID
From vwRofstData_RofstDatabases rd
Where rd.RofstID = @RofstID
And rd.dbiID = @dbiID;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetDatabases] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetDatabases]
(
@RofstID int
)
With Execute as Owner
As
Begin
Select rd.RofstID,
rd.dbiID,
rd.dbiType,
rd.dbiAW,
rd.dbiTitle,
rd.dbiAP,
rd.ID,
rd.ParentID
From vwRofstData_RofstDatabases rd
Where rd.RofstID = @RofstID
Order By rd.dbiID Asc;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetRofstByID] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstDataGetRofstByID]
(
@RofstID int,
@IncludeRoLookup Bit
)
With Execute as Owner
As
Begin
Select r.ROFstID,
r.RODbID,
Case (@IncludeRoLookup) When 1 Then r.ROLookup Else null End as 'ROLookup',
r.DTS,
r.UserID,
r.LastChanged
From ROFsts r with (NoLock)
Where r.RofstID = @RofstID;
Return;
End
GO
/****** Object: StoredProcedure [dbo].[vesp_RofstHeaderInsert] Script Date: 4/8/2022 9:34:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
/*
==========================================================================================================
Author: Jake Ropar
Create Date: 03/24/2022
Description:
==========================================================================================================
*/
Create Procedure [dbo].[vesp_RofstHeaderInsert]
(
@RofstID Int,
@hSize Int,
@hMonth Int,
@hDay Int,
@hcYear Int,
@hcMonth Int,
@hcDay Int,
@hcHour Int,
@hcMin Int,
@hcSec Int,
@hcHund Int,
@UserID VarChar(50)
)
With Execute as Owner
As
Begin
Insert Into RofstHeader (RofstID, hSize, hMonth, hDay, hcYear, hcMonth, hcDay, hcHour, hcMin, hcSec, hcHund, CreateUserID, CreateDate)
Values (@RofstID, @hSize, @hMonth, @hDay, @hcYear, @hcMonth, @hcDay, @hcHour, @hcMin, @hcSec, @hcHund, @UserID, GetDate());
Return;
End
GO