SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_grid_nm_countries_departments]
	@country_code AS ais_code_short,
	@dpi_code AS ais_code_short  = '%' 
AS
BEGIN
	SET NOCOUNT ON

	SELECT	*
	FROM	nm_countries_departments
	WHERE	nmctrd_country_code = @country_code
	and		(
			@dpi_code = '%' 
			OR 
			nmctrd_dpi_code = @dpi_code
			)
END

GO
