-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE procedure [C6Mart].[DM_ANAG_EMITTENTI]
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @ID_ELAB INT	
	SET @ID_ELAB = C6MART.GETIDELAB()
	TRUNCATE TABLE C6MART.ANAG_EMITTENTI
	INSERT INTO [C6Mart].[ANAG_EMITTENTI]
           ([ID_EMITTENTE]
           ,[DESCRIZIONE]
           ,[NOTE]
           ,[ID_ELAB])
	SELECT DISTINCT
		NULL AS ID_EMITTENTE,
		NULL AS DESCRIZIONE,
		NULL AS NOTE,
		@ID_ELAB AS ID_ELAB
	FROM C6STAGING.ALL_CF_PB
	WHERE 1 = 0
END