SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_pr_products_get_all_tables]
	@product_code ais_code_short
as

	set nocount on;


	select	* 
	from	pr_products
	where	prd_product_code = @product_code

	select	*
	from	pr_products_branches
	where	prdb_product_code = @product_code

	select	*
	from	pr_products_documents
	where	prdd_product_code = @product_code

	select	*
	from	pr_products_introducers
	where	prdint_product_code = @product_code

	select	*
	from	pr_products_variables_introducers
	where	prdvi_product_code = @product_code

	select	*
	from	pr_products_variables 
	where	prdv_product_code = @product_code

	select	*
	from	pr_products_variables_branches
	where	prdvb_product_code = @product_code

	select	t.*
	from	pr_products_variables_branches_repartitions t
			inner join pr_products_variables v on v.prdv_variable_id = t.prdvbr_variable_id
	where	v.prdv_product_code = @product_code

	select	t.*
	from	pr_products_variables_taxes t
			inner join pr_products_variables v on v.prdv_variable_id = t.prdvt_variable_id 
	where	v.prdv_product_code = @product_code

	select	tc.*
	from	pr_products_variables_taxes_cies tc
			inner join pr_products_variables v on v.prdv_variable_id = tc.prdvtc_variable_id 
	where	v.prdv_product_code = @product_code

	select	t.*
	from	pr_products_variables_commission_taxes t
			inner join pr_products_variables v on v.prdv_variable_id = t.prdvct_variable_id
	where	v.prdv_product_code = @product_code


	select	*
	from	usr_users_products
	where	usrp_product_code = @product_code




GO
