/***************************************
* STORED stp_UDC_getLast_ByParticolareStato
*
* elenco cartellini ULTIMO creati x particolare e stato
*
* Steamware, S.E.L.
* mod: 2014.01.21
*
****************************************/
create PROCEDURE [dbo].[stp_UDC_getLast_ByParticolareStato]
(
	@CodCS			NVARCHAR(2),
	@Particolare	NVARCHAR(15),
	@CodStato		NVARCHAR(50)
)
AS

	-- prendo ultimo UDC creato x il particolare
	SELECT		TOP 1 * FROM ElencoCartellini 
	WHERE		(Particolare= @Particolare) AND CodCS = @CodCS AND CodStato = @CodStato
	ORDER BY	CreateDate DESC

RETURN
