Get all Site Colletions with Primary and Secondary Contatct User Info from Sharepoint Content Database
--Get all site collections with primary secondary owner user info Select W . FullURl , W . Title , S . OwnerId , Max ( Case When S . OwnerId = U . tp_Id And S . Id = U . tp_siteId then U . tp_Login End ) as PrimaryLogin , Max ( Case When S . OwnerId = U . tp_Id And S . Id = U . tp_siteId then U . tp_Title End ) as PrimaryName , Max ( Case When S . OwnerId = U . tp_Id And S . Id = U . tp_siteId then U . tp_Email End ) as PrimaryEmailAddress , S . SecondaryContactID , Max ( Case When S . SecondaryContactID = U . tp_Id And S . Id = U . tp_siteId then U . tp_Login End ) as SecondaryLogin , Max ( Case When S . SecondaryContactID = U . tp_Id And S . Id = U . tp_siteId then U . tp_Title End ) as SecondaryName , Max ( Case When S . SecondaryContactID = U . tp_Id And S . Id = U . tp_siteId then U . tp_Email End ) as SecondaryEmailAddress , HostHeader , DiskUsed , LastContentChange , W . Id as WebId , W . SiteId , S . RootWebId