IF EXISTS(SELECT * FROM sys.objects where name = 'stp_Select_Usuario_byEmail')
BEGIN 
	DROP PROCEDURE stp_Select_Usuario_byEmail
END 
GO 


-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE stp_Select_Usuario_byEmail
	-- Add the parameters for the stored procedure here	
	@vchEmail int 
	
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
    Select 
		intUsuarioId, 
		vchUsuario,
		vchEmail, 
		vchContrasena, 
		vchTelefono, 
		vchMovil, 
		bitActivo, 
		datFalta,
		bitAdministrador
	From 
		UserQC.tbl_mst_Usuarios
	Where 
		vchEmail = @vchEmail
	order by 
		datFalta desc
    
  		 
END 
GO