/***************************************
* STORED stp_ContaCelleCreate
*
* effettua conteggio celle create nei blocchi del magazzino
*
* Steamware, S.E.L.
* mod: 2010.05.18
*
****************************************/
create PROCEDURE [dbo].[stp_ContaCelleCreate]
(
	@CodCS VARCHAR(2),
	@CodMag VARCHAR(50), 
	@TotCelle INT OUTPUT
)
AS

	SET @TotCelle = (SELECT		Count(IdxCella) AS Totale
	FROM		Celle
	WHERE		(IdxBlocco IN (SELECT IdxBlocco FROM Blocchi WHERE (CodCS = @CodCS) AND (CodMag = @CodMag)))
	)

RETURN @TotCelle
