-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE procedure [C6Mart].[SRV_SELECT_EMAIL_BY_ISODATE]
	@date VARCHAR(8)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	IF ISDATE(@date) = 0
		RETURN
	SELECT
		Email_Id,
		Rete,
		Cod_Fiscale,
		Tipo,
		Data_Generazione,
		Inviata,
		Data_Invio,
		Data_Comunicazione_Host,
		ID_ELAB
	FROM
		C6Mart.GESTIONE_EMAIL
	WHERE
		DATEPART(yy, Data_Generazione) = DATEPART(yy, @date) AND
		DATEPART(m, Data_Generazione) = DATEPART(m, @date) AND
		DATEPART(d, Data_Generazione) = DATEPART(d, @date)
END