Skip to content

Skrypty kontrahenci

konwersja maili

SQL
update firm.firm set email = replace(email,',',' ')  where email like '%,%'
update firm.firm set email = replace(email,';',' ')  where email like '%;%'
update firm.firm set email = replace(email,'  ',' ')  where email like '%  %'
update firm.firm set email = replace(email,'  ',' ')  where email like '%  %'

insert into firm.contact
    (contactname,firmid,email)

    select * from (
select  'Kontakt'contactname ,firmid,
   LEFT(email, CHARINDEX(' ', email + ' ') - 1) as 'split_values'
   from firm.firm where email is not null
) x where  split_values not in (select email from firm.contact where status>-1 and isnull(email,'') !='')

normalizacja nip

SQL
update firm.firm set taxcode = replace(taxcode,' ','')  where taxcode like '% %'
update firm.firm set taxcode = replace(taxcode,'-','')  where taxcode like '%-%'

Przywrócenie firmy

SQL
1
2
3
update
   [firm].[firm]
  set status =0 , fulltextcat=0 where firmid ='D937ED6A-F3DF-EC11-9587-D89D6719E0CA'