mesa-fab-approval/Programmability/Functions/fn_GetMeetingAI_Responsibles.sql
Mike Phares ab800974b7 Programmability objects from database
Removed commented code
Added fn_GetExpiredTECNByOriginator
2024-12-12 12:15:46 -07:00

45 lines
1.1 KiB
Transact-SQL

USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMeetingAI_Responsibles] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMeetingAI_Responsibles] (
-- Add the parameters for the function here
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT AI.ID AS MeetingActionItemID,
STUFF (
(
SELECT
', ' + LTRIM(
RTRIM(
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(50))
)
)
FROM
CCMeetingActionItemResponsible AIR
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
WHERE
AI.ID = AIR.MeetingActionItemID
AND AI.ClosedDate IS NULL FOR XML PATH('')
),
1,
1,
''
) AS Responsibles
FROM
CCMeetingActionItem AI
WHERE
AI.ClosedDate IS NOT NULL
)
GO