﻿USE [FabApprovalSystem]
GO
	/****** Object:  UserDefinedFunction [dbo].[fn8DConvertCANoToCADisplayFormat]    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].[fn8DConvertCANoToCADisplayFormat] (
		-- Add the parameters for the function here
		@CANo INT
	) RETURNS VARCHAR(10) AS BEGIN -- Declare the return variable here
	DECLARE @CADisplay VARCHAR(10) -- Add the T-SQL statements to compute the return value here
SET
	@CADisplay = LTRIM(
		RTRIM(
			CAST(
				'C' + RIGHT(
					'00000' + ISNULL(CAST(@CANo AS VARCHAR(10)), ''),
					5
				) AS VARCHAR(50)
			)
		)
	) -- Return the result of the function
	RETURN @CADisplay
END
GO