SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_grid_grpzon_zones_find]
    @group_code ais_code_short,
    @country_code ais_code_short = '%',
    @post_code ais_code_medium = '%'
AS 

	select	*
	from	grpzon_zones 
			inner join nm_countries_postcodes	on	nmpc_country_code = zonz_country_code
												AND	nmpc_postcode_code = zonz_postcode_code
												AND	nmpc_order = zonz_order
	where	zonz_group_code = @group_code
	AND		(@country_code = '' or @country_code = '%' or zonz_country_code = @country_code)
	AND		(zonz_postcode_code like @post_code)
	
GO
