IF NOT EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ComtradeMPXAXD_SessionUserNames_DataGet')
BEGIN
EXECUTE ('CREATE PROCEDURE dbo.[ComtradeMPXAXD_SessionUserNames_DataGet] AS RETURN 1')
END
GO
ALTER PROCEDURE [dbo].[ComtradeMPXAXD_SessionUserNames_DataGet]
@AddZeroRow int = 0
AS
--TODO: need to consider ManagementGroupRowId
IF @AddZeroRow = 1
BEGIN
SELECT -1 as UserNameId, '<Add users from the text box below>' as UserName
UNION
SELECT LTUserRowId AS UserNameId, UserName
FROM ComtradeMPXAXD.LTUser
WHERE UserName IS NOT NULL
ORDER BY UserName
END
ELSE
BEGIN
SELECT LTUserRowId AS UserNameId, UserName
FROM ComtradeMPXAXD.LTUser
WHERE UserName IS NOT NULL
ORDER BY UserName