1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[FN_DECIMAL_EN_CHIFFRE] (@I DECIMAL(18,4), @Ent_Part VARCHAR(30), @Sep VARCHAR(30), @Dec_Part VARCHAR(30))
RETURNS VARCHAR(256)
AS
BEGIN
DECLARE @I_String VARCHAR(19), @ReturnVal VARCHAR(100), @Entier INT, @Decimal INT
SET @I_String = dbo.fctDec4ToStr(@I)
SET @Entier = CAST(LEFT(@I_String, CHARINDEX(',',@I_String)-1) AS INT)
SET @Decimal = SUBSTRING(@I_String,CHARINDEX(',',@I_String)+1,LEN(@I_String)-CHARINDEX(',',@I_String)+1)
IF (@Decimal > 0)
SET @ReturnVal=dbo.FN_NOMBRE_EN_CHIFFRE(@Entier)+' '+@Ent_Part+' '+@Sep+' '+dbo.FN_NOMBRE_EN_CHIFFRE(@Decimal)+' '+@Dec_Part
ELSE
SET @ReturnVal=dbo.FN_NOMBRE_EN_CHIFFRE(@Entier)+' '+@Ent_Part
RETURN @ReturnVal
END |
Partager