/***************************************
* STORED stp_A2U_getByUDC
*
* recupera attributi UDC
*
* Steamware, S.E.L.
* mod: 2014.01.14
*
************************************/
CREATE PROCEDURE [dbo].[stp_A2U_getByUDC]
(
	@UDC	NVARCHAR(50)
)
AS

SELECT	a.idxAttr
	,a.UDC
	,a.CodAttr
	,CASE a.CodAttr WHEN 'NT' THEN RIGHT(a.ValAttr,10)   -- se trattamento lo formatto come x cartellini
				  ELSE a.ValAttr 
	END AS ValAttr
	,a.DateAttr
	--,RilPro.AnagOperatori.Cognome + ' ' + RilPro.AnagOperatori.Nome AS CodSoggetto
	,a.CodSoggetto
FROM dbo.Attr2UDC AS a
INNER JOIN RilPro.AnagOperatori AS o
ON a.CodSoggetto = o.CodSoggetto
WHERE (a.UDC = @UDC)
ORDER BY a.CodAttr
		,a.ValAttr


RETURN