SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_claim_events_find]
	@event_code				ais_code_medium,
	@category_code			ais_code_short,
	@name					nvarchar(64),
	@year					int,
	@description			nvarchar(1024),
	@place_occurence		nvarchar(256)
as


	set nocount on;

	select	e.*
	from	claim_events e
	where	evt_event_code like @event_code
	and		isnull(evt_category_code, '') like @category_code
	and		isnull(evt_name, '') like @name
	and		isnull(evt_description, '') like @description
	and		isnull(evt_place_occurrence, '') like @place_occurence
	and		@year between year(isnull(evt_date_start, '01/01/1900')) and year(isnull(evt_date_end, '01/01/2100'))
GO
