All pastes #767025 Raw Edit

rzeba

public sql v1 · immutable
·published 2007-11-09 12:13 UTC
rendered paste body
--przenumerowanie wszystkiego w systemie co narodzil sklep.-- ... bo jakiś cretino nie ustawił sekwencji drop table new_dok_ka;drop table new_p_dok_ka;drop table new_dok_sp_spo_pl;drop table new_dok_ma;drop table new_p_dok_ma;drop table new_p_dok_sp;drop table new_dok_sp;drop table new_dok_re;create table new_dok_ka as select * from dok_ka where id<'57250000';create table new_p_dok_ka as select * from p_dok_ka where dok_ka_id<'57250000';create table new_dok_sp_spo_pl as select * from dok_sp_spo_pl where dok_sp_id<'57250000';create table new_dok_ma as select * from dok_ma where id >'50000000' and id<'57250000';create table new_p_dok_ma as select * from p_dok_ma where dok_ma_id >'50000000' and dok_ma_id<'57250000';create table new_p_dok_sp as select * from p_dok_sp where dok_sp_id>'50000000' and dok_sp_id<'57250000';create table new_dok_sp as select * from dok_sp where id >'50000000' and id<'57250000';create table new_dok_re as select * from dok_re where id >'50000000' and id<'57250000';--dok_spupdate new_dok_sp set id=id+1000000;update new_dok_sp set dat_p=null where id >'50000000' and id<'57250000';update new_p_dok_sp set dok_sp_id=dok_sp_id+1000000;update new_p_dok_sp set p_dok_sp_dok_sp_id=p_dok_sp_dok_sp_id+1000000;update new_dok_sp set dok_sp_id=dok_sp_id+1000000 where dok_sp_id is not null;--dok_reupdate new_dok_re set id=id+1000000;update new_dok_re set dok_sp_id=dok_sp_id+1000000 where dok_sp_id<'57250000';--dok_maupdate new_dok_ma set id=id+1000000 where id >'50000000' and id<'57250000';update new_dok_ma set dat_p=null where id >'50000000' and id<'57250000';update new_dok_ma set dok_ma_id=dok_ma_id+1000000 where dok_ma_id is not null and dok_ma_id >'50000000' and dok_ma_id<'57250000';update new_dok_ma set dok_sp_id=dok_sp_id+1000000 where dok_sp_id is not null and dok_sp_id >'50000000' and dok_sp_id<'57250000';--dok_kaupdate new_dok_ka set id=id+1000000 where id >'50000000' and id<'57250000';update new_p_dok_ka set dok_ka_id=dok_ka_id+1000000 where dok_ka_id >'50000000' and dok_ka_id<'57250000';update new_p_dok_ka set tab_id=tab_id+1000000 where tab_id >'50000000' and tab_id<'57250000';--dok_sp_spo_plupdate new_dok_sp_spo_pl set dok_sp_id=dok_sp_id+1000000 where dok_sp_id>'50000000' and dok_sp_id<'57250000';--wstawianie--naglowki dok_sp, dok_ma--wlasciwe poprawki, modlmy sie...--begin;insert into dok_sp select * from new_dok_sp;insert into dok_ma select * from new_dok_ma;--odblokowanie dok_sp/dok_maupdate dok_sp set dat_p=null where id >'50000000' and id<'57250000';update dok_ma set dat_p=null where id >'50000000' and id<'57250000';--pozycje dok_sp; wstawienieinsert into p_dok_sp select * from new_p_dok_sp;--pozycje dok_ma; przesuniecieupdate p_dok_ma set dok_ma_id=dok_ma_id+1000000 where dok_ma_id is not null and dok_ma_id >'50000000' and dok_ma_id<'57250000';update p_dok_ma set p_dok_sp_dok_sp_id=p_dok_sp_dok_sp_id+1000000 where p_dok_sp_dok_sp_id is not null and p_dok_sp_dok_sp_id>'50000000' and p_dok_sp_dok_sp_id<'57250000';--skasowanie starych pozycji z dok_sp, teraz juz mozna to zrobicupdate p_dok_sp set p_dok_sp_dok_sp_id=null where dok_sp_id>'50000000' and dok_sp_id<'57250000';--update p_dok_sp set dok_sp_id=dok_sp_id+1000000 where dok_sp_id>'50000000' and dok_sp_id<'57250000';--teraz mozna skasowacdelete from p_dok_sp where dok_sp_id>'50000000' and dok_sp_id<'57250000';--kasainsert into dok_ka select * from new_dok_ka;insert into p_dok_ka select * from new_p_dok_ka;--pdk_dodupdate pdk_dod set p_dok_ka_dok_ka_id=p_dok_ka_dok_ka_id+1000000 where p_dok_ka_dok_ka_id>'50000000' andp_dok_ka_dok_ka_id<'57250000';--dok_ka_karupdate dok_ka_kar set dok_ka_id=dok_ka_id+1000000;delete from p_dok_ka where dok_ka_id >'50000000' and dok_ka_id<'57250000';delete from dok_ka where  id >'50000000' and id<'57250000';--spo_plinsert into dok_sp_spo_pl select * from new_dok_sp_spo_pl;delete from dok_sp_spo_pl where dok_sp_id>'50000000' and dok_sp_id<'57250000';--potwierdzenie dok-sp/dok-ma--dok_reinsert into dok_re select * from new_dok_re;update rek_st set dok_re_id=dok_re_id+1000000 where dok_re_id >'50000000' and dok_re_id<'57250000';delete from dok_re where id>'50000000' and id<'57250000';delete from dok_ma where id >'50000000' and id<'57250000';delete from dok_sp where id >'50000000' and id<'57250000';update dok_sp set dat_p='2007-09-29' where id >'50000000' and id<'56750200';update dok_ma set dat_p='2007-09-29' where id >'50000000' and id<'56750200';delete from dok_ma where id >'50000000' and id<'57250000';delete from dok_sp_spo_pl where dok_sp_id>'50000000' and dok_sp_id<'57250000';delete from dok_sp where id >'50000000' and id<'57250000';--i koniec rzeźby :]--kthxbye