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

28 lines
704 B
Transact-SQL

USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnPlanConvertPlanNoToDisplayFormat] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnPlanConvertPlanNoToDisplayFormat] (
-- Add the parameters for the function here
@PlanNo INT
) RETURNS VARCHAR(10) AS BEGIN -- Declare the return variable here
DECLARE @Display VARCHAR(10) -- Add the T-SQL statements to compute the return value here
SET
@Display = LTRIM(
RTRIM(
CAST(
'P' + RIGHT(
'0000' + ISNULL(CAST(@PlanNo AS VARCHAR(10)), ''),
5
) AS VARCHAR(50)
)
)
) -- Return the result of the function
RETURN @Display
END
GO