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

?-- =============================================
-- Description: Returns list of regions with a null handler that ties into the reporting.
--
-- Maintenance Log:
--
-- Update By Update Date Description
-- ----------- --------- ----------------------------
-- =============================================
CREATE PROCEDURE seclyr.[uspRptGetUserRegionsListWithNullHandler]
@userId int,
@moduleIds varchar(max)
AS
DECLARE @resultsTable table
(
RowID int,
ModuleID tinyint,
RegionID tinyint,
RegionCode varchar(10),
RegionName varchar(50),
Inactive bit
)

BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

BEGIN TRY

INSERT INTO @resultsTable (RowID, ModuleID, RegionID, RegionCode, RegionName, Inactive)
EXEC seclyr.uspGetUserVHARegions @userId, @moduleIds;

SELECT
RegionID
, RegionCode
, RegionName
FROM (
SELECT
0 AS RegionID
, '0' AS RegionCode
, '[Null Values]' AS RegionName
UNION
SELECT DISTINCT RegionID, RegionCode, RegionName
FROM @resultsTable
--uncomment the next line if need to do single select and have an "all" regions
--UNION SELECT 0 AS RegionID, NULL AS RegionCode, '[All]' AS 'RegionName'
) AS SubQ
ORDER BY RegionID, RegionName
;
END TRY
BEGIN CATCH
PRINT 'There was an while getting user region reporting list with null handler' + CHAR(13);
SELECT * FROM dbo.ufnGetErrorInfo();
EXEC uspRaiseErrorInfo;
END CATCH
END
GO