
	IF OBJECT_ID('NET_SEL_ETICKET') IS NOT NULL
		DROP PROC NET_SEL_ETICKET

	GO
		CREATE PROC NET_SEL_ETICKET
	(
				   @pCodEticket	int
				  ,@pTitulo	varchar(200)
				  ,@pStatus	int
				  ,@pOrder VARCHAR(50) =  NULL 

	)
	AS 
		
		BEGIN
			SET NOCOUNT ON
			
					SELECT 
						  CodEticket
						,HTML
						,Titulo
						,CodUsuario
						,DataCadastro
						,Dataupdate
						,Status
		FROM 
						NET_ETICKET
WHERE     
					((CodEticket = @pCodEticket) Or (@pCodEticket IS NULL OR @pCodEticket  = 0))
			And ((Titulo Like  @pTitulo + '%') Or (@pTitulo IS NULL OR @pTitulo= ''))
			And ((Status = @pStatus) Or (@pStatus IS NULL OR @pStatus  = 3))
			

	SET NOCOUNT OFF 
	END 

