I realized a bit late that the code below doesn't work. If there is an assistant manager, but no manager I still get a blank and that is incorrect.
So this is the replacement code:
I tested it out and it seems to take care of all the different situations. But just wanted to make sure with you guys. Thanks.
Code:
COALESCE(dbo.udfGetManager(CM.ControlID) + ', ' + dbo.udfGetAssistantManager(CM.ControlID), '')
So this is the replacement code:
Code:
CASE WHEN MIN(dbo.udfGetManager(CM.ControlID)) IS NULL THEN CASE WHEN MIN(dbo.udfGetAssistantManager(CM.ControlID)) IS NULL THEN ''
ELSE MIN(dbo.udfGetAssistantManager(CM.ControlID)) END
WHEN MIN(dbo.udfGetManager(CM.ControlID)) IS NOT NULL THEN CASE WHEN MIN(dbo.udfGetAssistantManager(CM.ControlID)) IS NULL THEN MIN(dbo.udfGetManager(CM.ControlID))
ELSE MIN(dbo.udfGetManager(CM.ControlID)) + ', ' + MIN(dbo.udfGetAssistantManager(CM.ControlID)) END
END
I tested it out and it seems to take care of all the different situations. But just wanted to make sure with you guys. Thanks.