1
Reply

Hai I am MCA student I am doing a project In my project database more than 5 tables I am maintain these 5 tables relation in 6 table,I am inserting data in to this 5 tables,This 5 id will go and store the 6 table.How to write Stored Procedure.

    create procedure Table6_Id_Insert @data_For_five_table nvarchar(20) --Let Data is same for all table as begin @Value_Holder1 int; @Value_Holder2 int; @Value_Holder3 int; @Value_Holder4 int; @Value_Holder5 int; insert into table1 values(@data_For_five_table ); insert into table2 values(@data_For_five_table ); insert into table3 values(@data_For_five_table ); insert into table4 values(@data_For_five_table ); insert into table5 values(@data_For_five_table );select @Value_Holder1 = id from table1 where field = @data_For_Five; select @Value_Holder2 = id from table2 where field = @data_For_Five; select @Value_Holder3 = id from table3 where field = @data_For_Five; select @Value_Holder4 = id from table4 where field = @data_For_Five; select @Value_Holder5 = id from table5 where field = @data_For_Five; insert into table6 values( @Value_Holder1, @Value_Holder2, @Value_Holder3, @Value_Holder4, @Value_Holder5 ) --We are Guessing That Each Table Contain Different Sno. that why we take different Variable.