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

28 lines
711 B
Transact-SQL

USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnAuditConvertAuditNoToDisplayFormat] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnAuditConvertAuditNoToDisplayFormat] (
-- Add the parameters for the function here
@AuditNo 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(
'A' + RIGHT(
'00000' + ISNULL(CAST(@AuditNo AS VARCHAR(10)), ''),
5
) AS VARCHAR(50)
)
)
) -- Return the result of the function
RETURN @Display
END
GO