

/***************************************
* function componiUdc
*
* compone il cod UDC a partire da 
* - "U" fisso
* - CodCS (codice company sito, 2 char)
* - Flusso (codice flusso-bilancia 2 char)
* - @Anno (anno, 2 char)
* - @numUdc (progr annuale, 2 char)
*
* Steamware, S.E.L.
* mod: 2010.09.23
*
****************************************/
CREATE FUNCTION [dbo].[componiUdc]
(
	@CodCS NVARCHAR(2),
	@Flusso NVARCHAR(2),
	@Anno NVARCHAR(2),
	@numUdc INT
)
RETURNS NVARCHAR(13)
AS
	BEGIN
	
		DECLARE @answ AS NVARCHAR(50)
	
		SET @answ = UPPER('U' + @CodCS + @Flusso + @Anno + dbo.f_padLeft(CAST(@numUdc AS VARCHAR(6)), 6, '0'))
	
	RETURN @answ
	END

