create proc Search_Lamp ( @panduan varchar(1), @Lamp varchar(20), @Factory varchar(20), @count varchar(5) output ) as BEGIN if exists(select * from Factory where @panduan='1') BEGIN select @count=Count(*) from Lamp l,Factory f where L_Name Like @Lamp and l.F_ID=f.F_ID select f.F_ID,l.L_ID,l.L_Name,f.F_Name from Lamp l,Factory f where L_Name Like @Lamp and l.F_ID=f.F_ID order by f.F_ID asc,l.L_ID asc
END else if exists(select * from Factory where @panduan='2') BEGIN select @count=Count(*) from Lamp l,Factory f where F_Name Like @Factory and l.F_ID=f.F_ID select f.F_ID,l.L_ID,l.L_Name,f.F_Name from Lamp l,Factory f where F_Name Like @Factory and l.F_ID=f.F_ID order by f.F_ID asc,l.L_ID asc
END else if exists(select * from Factory where @panduan='3') BEGIN select @count=Count(*) from Lamp l,Factory f where L_Name Like @Lamp and F_Name Like @Factory and l.F_ID=f.F_ID select f.F_ID,l.L_ID,l.L_Name,f.F_Name from Lamp l,Factory f where L_Name Like @Lamp and F_Name Like @Factory and l.F_ID=f.F_ID order by f.F_ID asc,l.L_ID asc
create proc Sreach_LampandFactory ( @return varchar(2) output ) as BEGIN select @return=count(L_ID) from Lamp select f.F_ID,l.L_ID,f.F_Name,l.L_Name,l.L_Purchace,l.L_Price,l.L_Number from Lamp l,Factory f where f.F_ID=l.F_ID order by f.F_ID asc ,l.L_ID asc END