SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE [dbo].[p_doc_collections_get_result_merge]
	@collection_id int
AS

	/*
	DGE 28/02/2016

	Cette procédure sert à déterminer:
	- le nombre total de documents d'une collection;
	- le nombre d'anomalies de fusion (statut ME)
	*/

	SELECT	count(*) AS TOTAL,
			SUM(CASE WHEN dcd_status_code = 'ME' THEN 1 ELSE 0 END) AS ERR
	from	doc_collections_docs
	where dcd_collection_id = @collection_id

GO
