if object_id ('bioRecord') is not null drop table bioRecord

select bioRecord.* 
into bioRecord
from syn_world.dbo.bioRecord
join syn_world.dbo.institution_code on institution_code_id = id
join syn_world.dbo.resource on bioRecordResourceKey = resourceKey
where institution_code in ('B', 'BGBM')
  and dataset_uuid not in ('638110a0-f762-11e1-a439-00145eb45e9a', 'e1beb83c-9b83-4d17-ac5e-d24e09507ec5')	-- exclude BoBO and Geo-Tag der Artenvielfalt
  and (   recordBasis in ('s', 't')
       or dataset_uuid in ( 'https://www.gbif.org/dataset/d5bb611e-54b0-4d6d-ab8f-adc2fa6edc96',	-- ten herbarium specimen records from CONABI without recordBasis
							'https://www.gbif.org/dataset/7f707904-f762-11e1-a439-00145eb45e9a')
	  )