[dbo].[MssWebGetOrganizationLaborEmailAddresses]
CREATE PROCEDURE [dbo].[MssWebGetOrganizationLaborEmailAddresses]
AS
BEGIN
SELECT Name = dbo.FormatFirstNameLastName(Sysuser.FIRSTNAME, Sysuser.LASTNAME),
EmailAddress = Sysuser.EMAIL,
LaborType = LaborType.LaborType
FROM Sysuser
JOIN SysUserLaborTypeMap
ON SysUserLaborTypeMap.SysUserFID = Sysuser.SysUserID
AND ISNULL(SysUserLaborTypeMap.[Default], 0) = 1
LEFT JOIN LaborType
ON LaborType.PriKey = SysUserLaborTypeMap.LaborTypeFID
WHERE LTRIM(RTRIM(ISNULL(Sysuser.EMAIL, ''))) <> '';
END;
GO
GRANT EXECUTE ON [dbo].[MssWebGetOrganizationLaborEmailAddresses] TO [MssExec]
GO