
SELECT        'Sites' AS 'Table', SitesGeom.SiteCode, Sites.SiteName, sitesgeom.guid
FROM            SitesGeom INNER JOIN
                         Sites ON SitesGeom.SiteCode = Sites.SiteCode
WHERE        (SitesGeom.Geom.STGeometryType() = 'geometrycollection')
order by Sites.SiteName

SELECT        'Compartments' AS 'Table', SitesCompartmentsGeom.SiteCode, Sites.SiteName, SitesCompartmentsGeom.CompartmentCode, SitesCompartments.Name, SitesCompartmentsgeom.guid
FROM            SitesCompartmentsGeom INNER JOIN
                         SitesCompartments ON SitesCompartmentsGeom.SiteCode = SitesCompartments.SiteCode AND 
                         SitesCompartmentsGeom.CompartmentCode = SitesCompartments.CompartmentCode INNER JOIN
                         Sites ON SitesCompartments.SiteCode = Sites.SiteCode
WHERE        (SitesCompartmentsGeom.Geom.STGeometryType() = 'geometrycollection')
order by Sites.SiteName,SitesCompartmentsGeom.CompartmentCode

SELECT        'Features' AS 'Table', FeaturesGeom.SiteCode, Sites.SiteName, FeaturesGeom.FeatureNumber, Features.FeatureName, featuresgeom.guid
FROM            FeaturesGeom INNER JOIN
                         Features ON FeaturesGeom.SiteCode = Features.SiteCode AND FeaturesGeom.FeatureNumber = Features.FeatureNumber INNER JOIN
                         Sites ON Features.SiteCode = Sites.SiteCode
WHERE        (FeaturesGeom.Geom.STGeometryType() = 'geometrycollection')
order by FeaturesGeom.SiteCode, FeaturesGeom.FeatureNumber

SELECT        'SharedGeom' AS 'Table', SiteCode, Description, SystemType, IsCurrent, guid
FROM            SharedGeom
WHERE        (Geom.STGeometryType() = 'geometrycollection')
ORDER BY SiteCode, SystemType, Description

SELECT        'Parcels' AS 'Table', AMS.PCT_Parcels.SiteCode, AMS.PCT_Parcels.CadasterParcelNumber, AMS.PCT_Geometry.guid
FROM            AMS.PCT_Parcels INNER JOIN
                         AMS.PCT_Geometry ON AMS.PCT_Parcels.GUID = AMS.PCT_Geometry.PCT_ParcelGUID
WHERE        (PCT_Geometry.Geom.STGeometryType() = 'geometrycollection')
ORDER BY AMS.PCT_Parcels.SiteCode, AMS.PCT_Parcels.CadasterParcelNumber

SELECT        'Objects' AS 'Table', Sites.SiteCode, Sites.SiteName, CHM.OBJ_ObjectGroupLUT.Description, CHM.OBJ_Objects.ObjectName, 
                         CHM.OBJ_Objects.ObjectNumber, CHM.OBJ_Geometry.guid
FROM            CHM.OBJ_Geometry INNER JOIN
                         CHM.OBJ_Objects ON CHM.OBJ_Geometry.OBJ_ObjectGUID = CHM.OBJ_Objects.GUID INNER JOIN
                         CHM.OBJ_ObjectClassLUT ON CHM.OBJ_Objects.OBJ_ObjectClassLUTGUID = CHM.OBJ_ObjectClassLUT.GUID AND 
                         CHM.OBJ_Objects.OBJ_ObjectClassLUTGUID = CHM.OBJ_ObjectClassLUT.GUID INNER JOIN
                         CHM.OBJ_ObjectGroupLUT ON CHM.OBJ_ObjectClassLUT.OBJ_ObjectGroupLUTGUID = CHM.OBJ_ObjectGroupLUT.GUID INNER JOIN
                         Sites ON CHM.OBJ_Objects.SiteGUID = Sites.guid
						 WHERE        (OBJ_Geometry.Geom.STGeometryType() = 'geometrycollection')
ORDER BY Sites.SiteName, CHM.OBJ_ObjectGroupLUT.Description, CHM.OBJ_Objects.ObjectNumber

SELECT         'PCT_Imports' AS 'Table',CD_KAD_GEM, SECTIE, PERCEELNR, OBJECTLT, OBJECTNR, fid
FROM            AMS.PCT_Imports
WHERE        (Geom.STGeometryType() = 'geometrycollection')
ORDER BY CD_KAD_GEM, SECTIE, PERCEELNR, OBJECTLT, OBJECTNR

