28 lines
711 B
Transact-SQL
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 |