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

	GO
		CREATE PROC NET_INSERT_PARTICIPANTE_ETICKET
	(
						 @pCodParticipanteEticket	int
						,@pCodParticipante	VARCHAR(3000)
						,@pCodEticket	int
						,@pCodUsuario	int
		)
	AS 
		
		BEGIN
			SET NOCOUNT ON
			
			INSERT INTO 
						NET_PARTICIPANTE_ETICKET
		(
					 CodParticipante
					,CodEticket
					,DataCadastro
					,CodUsuario
			)
		SELECT 
					Item
					,@pCodEticket
					,getDate()
					,@pCodUsuario	
		FROM 
					 fnsplit(@pCodParticipante,',')

SELECT 
				Email 
				,nome
	FROM 
				NET_PARTICIPANTE
	WHERE
				CodParticipante IN (
													SELECT 
																		Item
															FROM 
																		 fnsplit(@pCodParticipante,',')
)

		
	SET NOCOUNT OFF 
	END 


