SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_grid_nm_pol_monthly_payments]
	@monthly_payment_code AS ais_code_short  = '%' 
AS
BEGIN
	SET NOCOUNT ON

	SELECT	npmp.*,
			STUFF((
			  SELECT '/' + convert(varchar, npmpd.nmpmpd_day)
			  FROM nm_pol_monthly_payments_days npmpd
			  WHERE npmpd.nmpmpd_monthly_payment_code = npmp.nmpmp_monthly_payment_code
			  order by npmpd.nmpmpd_day asc
			  FOR XML PATH('')), 1, 1, '') as nmpmp_days_string 
	FROM nm_pol_monthly_payments npmp
	WHERE @monthly_payment_code = '%' OR nmpmp_monthly_payment_code = @monthly_payment_code
END
GO
