if not exists  (select * from RegFunctions where LCase(name) = LCase('GenerateDESADVXML')) then
  insert into RegFunctions (name, ftype)
    values ('GenerateDESADVXML',3)
end if

go

if not exists  (select * from RegFunctions where LCase(name) = LCase('GenerateInvoiceXML')) then
  insert into RegFunctions (name, ftype)
    values ('GenerateInvoiceXML',3)
end if

go

if not exists (select * from Counters where id = 2) then
  insert into counters(id,name,counter)
    values(2,'XML Counter',0)
end if 

go
