Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

alter procedure uploadtemplate_to_business_profile as truncate table images truncate table videos truncate table password truncate table Business_Profile

truncate table Business_Profile_details update uploadtemplate set Category = REPLACE(Category,'&','and') update uploadtemplate set Address = REPLACE(Address,'"',' ') update uploadtemplate set Keywords = REPLACE(Keywords,'"',' ') update uploadtemplate set Keywords = REPLACE(Keywords,'&','and') insert into Business_Profile select BusinessProfileId, ContactPerson,CompanyName,Category,Address,Area,City,State,Country,Pincode,Ph oneNumber,FaxNumber,Email,Website,Keywords,BusinessProfile from uploadtemplate declare @bpid bigint declare @bmpid bigint declare @fname nvarchar(500) declare c1 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,firstname from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where firstname is not null open c1 fetch next from c1 into @bpid,@bmpid,@fname while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'First Name',@fname,'0') fetch next from c1 into @bpid,@bmpid,@fname end close c1 deallocate c1 --Last Name declare @Lname nvarchar(500) set @bmpid=0 set @bpid =0 declare c2 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Lastname from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Lastname is not null open c2 fetch next from c2 into @bpid,@bmpid,@Lname while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Last Name',@Lname,'0') fetch next from c2 into @bpid,@bmpid,@Lname end close c2 deallocate c2

--Degination declare @Degination nvarchar(500) set @bmpid=0 set @bpid =0 declare c3 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Deginatio n from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Degination is not null open c3 fetch next from c3 into @bpid,@bmpid,@Degination while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Degination',@Degination,'0') fetch next from c3 into @bpid,@bmpid,@Degination end close c3 deallocate c3 --Address2 declare @AddressSecond nvarchar(500) set @bmpid=0 set @bpid =0 declare c4 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Address2 from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Address2 is not null open c4 fetch next from c4 into @bpid,@bmpid,@AddressSecond while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Address2',@AddressSecond,'0') fetch next from c4 into @bpid,@bmpid,@AddressSecond end close c4 deallocate c4 --Address3 declare @AddressThree nvarchar(500) set @bmpid=0 set @bpid =0 declare c5 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Address3 from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Address3 is not null open c5 fetch next from c5 into @bpid,@bmpid,@AddressThree while @@FETCH_STATUS = 0 begin

insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Address3',@AddressThree,'0') fetch next from c5 into @bpid,@bmpid,@AddressThree end close c5 deallocate c5 --Address4 declare @AddressFour nvarchar(500) set @bmpid=0 set @bpid =0 declare c6 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Address4 from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Address4 is not null open c6 fetch next from c6 into @bpid,@bmpid,@AddressFour while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Address4',@AddressFour,'0') fetch next from c6 into @bpid,@bmpid,@AddressFour end close c6 deallocate c6 --SicCode declare @SicCode nvarchar(500) set @bmpid=0 set @bpid =0 declare c7 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,SicCode from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where SicCode is not null open c7 fetch next from c7 into @bpid,@bmpid,@SicCode while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'SicCode',@SicCode,'0') fetch next from c7 into @bpid,@bmpid,@SicCode end close c7 deallocate c7 --Establised declare @Establised nvarchar(500) set @bmpid=0 set @bpid =0

declare c8 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Establise d from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Establised is not null open c8 fetch next from c8 into @bpid,@bmpid,@Establised while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Establised',@Establised,'0') fetch next from c8 into @bpid,@bmpid,@Establised end close c8 deallocate c8 --MD declare @MD nvarchar(500) set @bmpid=0 set @bpid =0 declare c9 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,MD from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where MD is not null open c9 fetch next from c9 into @bpid,@bmpid,@MD while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'MD',@MD,'0') fetch next from c9 into @bpid,@bmpid,@MD end close c9 deallocate c9 --NoOfEmployees declare @NoOfEmployees nvarchar(500) set @bmpid=0 set @bpid =0 declare c10 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,NoOfEmplo yees from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where NoOfEmployees is not null open c10 fetch next from c10 into @bpid,@bmpid,@NoOfEmployees while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'NoOfEmployees',@NoOfEmployees,'0') fetch next from c10 into @bpid,@bmpid,@NoOfEmployees

end close c10 deallocate c10 --Establised declare @Certification nvarchar(500) set @bmpid=0 set @bpid =0 declare c11 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Certifica tion from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Certification is not null open c11 fetch next from c11 into @bpid,@bmpid,@Certification while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Certification',@Certification,'0') fetch next from c11 into @bpid,@bmpid,@Certification end close c11 deallocate c11 --Service declare @Service nvarchar(500) set @bmpid=0 set @bpid =0 declare c12 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Service from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Service is not null open c12 fetch next from c12 into @bpid,@bmpid,@Service while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Service',@Service,'0') fetch next from c12 into @bpid,@bmpid,@Service end close c12 deallocate c12 --Activities declare @Activities nvarchar(500) set @bmpid=0 set @bpid =0 declare c13 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Activitie s from uploadtemplate inner join Business_Profile on

Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Activities is not null open c13 fetch next from c13 into @bpid,@bmpid,@Activities while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Activities',@Activities,'0') fetch next from c13 into @bpid,@bmpid,@Activities end close c13 deallocate c13 --Occuption declare @Occuption nvarchar(500) set @bmpid=0 set @bpid =0 declare c14 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Occuption from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Occuption is not null open c14 fetch next from c14 into @bpid,@bmpid,@Occuption while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Occuption',@Occuption,'0') fetch next from c14 into @bpid,@bmpid,@Occuption end close c14 deallocate c14 --MainMarkets declare @MainMarkets nvarchar(500) set @bmpid=0 set @bpid =0 declare c15 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,MainMarke ts from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where MainMarkets is not null open c15 fetch next from c15 into @bpid,@bmpid,@MainMarkets while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'MainMarkets',@MainMarkets,'0') fetch next from c15 into @bpid,@bmpid,@MainMarkets end close c15 deallocate c15

--Turnover declare @Turnover nvarchar(500) set @bmpid=0 set @bpid =0 declare c16 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Turnover from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where Turnover is not null open c16 fetch next from c16 into @bpid,@bmpid,@Turnover while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'Turnover',@Turnover,'0') fetch next from c16 into @bpid,@bmpid,@Turnover end close c16 deallocate c16 --TurnoverRange declare @TurnoverRange nvarchar(500) set @bmpid=0 set @bpid =0 declare c17 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,TurnoverR ange from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where TurnoverRange is not null open c17 fetch next from c17 into @bpid,@bmpid,@TurnoverRange while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'TurnoverRange',@TurnoverRange,'0') fetch next from c17 into @bpid,@bmpid,@TurnoverRange end close c17 deallocate c17 --InternationalImport declare @InternationalImport nvarchar(500) set @bmpid=0 set @bpid =0 declare c18 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Internati onalImport from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where InternationalImport is not null open c18 fetch next from c18 into @bpid,@bmpid,@InternationalImport while @@FETCH_STATUS = 0

begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'InternationalImport',@InternationalImport,'0') fetch next from c18 into @bpid,@bmpid,@InternationalImport end close c18 deallocate c18 --CorporateMarketing declare @CorporateMarketing nvarchar(500) set @bmpid=0 set @bpid =0 declare c19 cursor for select Business_Profile.businessprofileid,uploadtemplate.businessprofileid,Corporate Marketing from uploadtemplate inner join Business_Profile on Business_Profile.mapping_bus_id = uploadtemplate.businessProfileId where CorporateMarketing is not null open c19 fetch next from c19 into @bpid,@bmpid,@CorporateMarketing while @@FETCH_STATUS = 0 begin insert into Business_Profile_Details(businessprofile_id,business_mapping_id,attribute_nam e,attributevalue,status) values(@bpid,@bmpid,'CorporateMarketing',@CorporateMarketing,'0') fetch next from c19 into @bpid,@bmpid,@CorporateMarketing end close c19 deallocate c19 go select * select * truncate truncate truncate truncate from uploadtemplate from Business_Profile_details where businessprofile_id = 1 table Business_Profile table images table videos table password

You might also like