SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_scenario_forms] 
	@scen_code ais_code_short,
	@form_code ais_code_short = '%'
AS

BEGIN

	select 	sc_scen_code,sc_l1, sc_l2, sc_l3, sc_position_code, sc_type_code,
		sf_form_code,
		frm_form_code,frm_type_code, frm_l1, frm_l2, frm_l3, frm_assembly, frm_assembly_namespace
	from dyn_scenarios
		inner join dyn_scenarios_forms on sc_scen_code = sf_scen_code
		inner join dyn_forms on sf_form_code = frm_form_code
	where		sc_scen_code = @scen_code
			and (isnull(@form_code,'%') = '%' or frm_form_code = @form_code)
	order by sf_order asc
	
END







GO
